Internal I, 2011 Name : Roll No : Total Marks: 20 Time: 60 Minutes
For Question 1 to 4, Write your answer on this paper. You should EXPLAIN the answer in One or Two Sentence. For Question 4 & 5, Write your answer on Answer script.
1.
(2 points) (TRUE/FALSE) Round Robin(RR) scheduling is non-preemptive where as FCFS and Priority scheduling are preemptive.
2.
(2 points) How many processes will gate created after execution of the following code and Explain (You can show execution diagram) – main() { fork(); fork(); fork(); }
(2 points) (TRUE/FALSE) Suppose a thread is running in a critical section of code, meaning that it has acquired all the locks through proper arbitration. It can get context switched.
3.
4.
(4 points) (TRUE/FALSE) For each of the following thread/process state transitions, whether the transition is legal, (a) Change from thread/process state BLOCKED to thread state RUNNING.
(b) Change from thread/process state RUNNING to thread state BLOCKED.
(5 points) Assume you have the following jobs to execute with one processor, with the jobs arriving in the order listed here: Process P1 P2 P3 P4 P5 Execution time 80 20 10 20 50
5.
a) Suppose a system uses Shortest Job First(SJF) scheduling. Create a Gantt chart illustrating the execution of these processes? b) What is the turnaround time for process P4? c) What is the average wait time for the processes?
(5 points) A restaurant would like to serve four dinner parties, P1 through P4. The restaurant has a total of 8 plates and 12 bowls. Assume that each group of diners will stop eating and wait for the waiter to bring a requested item (plate or bowl) to the table when it is required. Assume that the diners don’t mind waiting. The maximum request and current allocation tables are shown as follows: Maximum Request P1 P2 P3 P4 Plates 7 6 1 2 Bowls 7 10 2 4 Current Allocation Plates P1 P2 P3 P4 2 3 0 1 Bowls 3 5 1 2
6.
a) Determine the Need Matrix