Operating Systems 1

Tutorial 3

  1. If a semaphore with initial value i has had s SIGNAL operations performed on it, what inequality expresses the number of (completed) WAIT operations which may have been performed?
  2. A process performs a READ operation on a pipe, and blocks (because no data is available). What could cause it to unblock?
  3. Under what circumstances might a WRITE operation to a pipe cause the writing process to block?
  4. What distinguishes a rendezvous, specifically, from a message SEND generally?
  5. Process A is streaming media data (audio and video) from a server on a network. Process B is displaying it. Process A and B share a buffer, to smooth out slight disturbences in the network transfer rate. Show how you might use semaphores to allow process A to put data into the the buffer while process B takes data out of the buffer, without race conditions, and without holding up either process needlessly.
  6. Task 1 sends two signals to task 2 (using signals, not semaphores). The code of task 2 attempts to wait for two signals, but ends up blocking indefinitely. What has gone wrong? Would the same problem have occurred if the tasks were communicating with semaphores?
  7. One solution to the Dining Philosopher's Problem is to provide a single, global semaphore. When a philosopher wishes to eat, the philosopher does a WAIT on the semaphore, then a SIGNAL once finished eating. This way only one philosopher ever picks up any forks, and deadlock is prevented. What is wrong with this soluion?
  8. Why is 'run until blocked' scheduling a not a good scheduling policy in general?
  9. In a round-robin scheduling system, the task-switch overhead is 3ms. There are four tasks, with quantums of length 20ms, 23ms, 40ms & 100ms. Assuming that all the tasks are CPU bound (they never block), what is the efficiency of the system? What is the worst-case response time?
  10. In a priority-based scheduling system, give an example of a criterion used to determine internal priority. Give an example of a criterion used to determine external priority?