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)
- You are supposed to design a highly reliable operating system. What is meant by ``reliable''? Which criteria and measures should be taken care?
- Compare the synchronous and asynchronous I/O requests and discuss programming aspects.
- Describe briefly; A real-time operating system.
- For a workload consisting of ten CPU-bound jobs of all the same length (each would run for 10 seconds in a dedicated environment);
- which scheduling policy would result in the lowest average response time?
- which scheduling policy would result in the lowest turnaround time?
- 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)
- What is meant by the term context switch? What might cause a context switch to occur?
- 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 |
|
|
|
- What is starvation, give an example?
- 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?
- Describe four ways to prevent deadlock by attacking the conditions required for deadlock.
- Why does the operating system need to provide mechanisms to facilitate process cooperation?
Part C.
- 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)
- There is only ``(a)'' request.
- There are both ``(a)'' and ``(b)'' requests.
- 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: About this document ...
Cem Ozdogan
2009-07-31