next up previous
Next: About this document ...

Ceng 328 Operating Systems
Midterm
April 5, 2007 16.40-18.30
Good Luck!
Part A. Short Answer, answer the questions with two or three sentences (each 5 pt)
  1. You are supposed to design a highly reliable operating system. What is meant by ``reliable''? Which criteria and measures should be taken care?





  2. Compare the synchronous and asynchronous I/O requests and discuss programming aspects.





  3. Describe briefly; A real-time operating system.





  4. For a workload consisting of ten CPU-bound jobs of all the same length (each would run for 10 seconds in a dedicated environment);
  5. What is an ``atomic'' operation? Give an example.



    Part B. Not Short Answer, you may answer the questions more than two sentences (each 7.5 pt)
  6. What is meant by the term context switch? What might cause a context switch to occur?







  7. Consider the following sets of processes, with the length of the CPU-burst time given in milliseconds. Arrival time is the time at which the process is added to the ready queue.
    Process Burst Time Arrival Time
    P1 10 0
    P2 5 0
    P3 3 0
    P4 4 0
    P5 2 4
    P6 1 6
    a
    Draw appropriate charts illustrating the execution of these processes using FCFS, SJF non-preemptive, and SJF preemptive.
    b
    Calculate the wait times of each process for each strategy. Calculate the average wait times under each strategy.
    Process FCFS SJF-nonpre SJF
    P1      
    P2      
    P3      
    P4      
    P5      
    P6      
    Average      
  8. What is starvation, give an example?







  9. Assume you are implementing a producer-consumer shared buffer (which can be used by producer threads to pass data to consumer threads), but that the buffer is unbounded; in other words, it does not have a limit as to how big it can get.
    a
    How many condition variables will you need in order to implement this buffer properly, and why?


    b
    How is this different than a standard bounded buffer implementation?



  10. Describe four ways to prevent deadlock by attacking the conditions required for deadlock.











  11. Why does the operating system need to provide mechanisms to facilitate process cooperation? Part C.
  12. The state of the system is with four processes and two multiple units resources described in resource allocation graph (see the Figure). Explain the cases that deadlock occurs and does not occur. (10 pts)
    Figure 1: Figure
    \includegraphics[scale=0.7]{figures/sorud1.ps}
  13. The Sleeping-Barber Problem. A barbershop consists of a waiting room with n chairs and the barber room containing the barber chair. If there are no customers to be served, the barber goes to sleep. If a customer enters the barbershop and all chairs are occupied, then the customer leaves the shop. If the barber is busy but chairs are available, then the customer sits in one of the free chairs. If the barber is asleep, the customer wakes up the barber. Write pseudo code to coordinate the barber and the customers.
    Hints: Need a global counter for the number of customers that are currently waiting in a chair. Use 3 semaphores - one for the customers ( barber waits till a customer signals they are ready), one for the barber ( customer waits tile barber signals he is ready ) and one for the critical section (where the global counter is modified). (20 pts)



next up previous
Next: About this document ...
Cem Ozdogan 2009-07-31