CS2201 Operating System QP
CS2201 Operating System QP
Enrolment No:
SECTION B
Q B1 Show how semaphore provides the solution to the reader writer problem. 4 CO4
Q B2 How many processes will be spawned after executing the code segment given below? 4 CO2
Also, draw the corresponding process tree. How can you verify that you have drawn
the correct process tree?
main ()
{
if (fork () || fork ())
if (fork () && fork ())
fork ();
}
Q B3 Write a program in ‘C’ (Linux OS) in which the parent process sends an integer value 4 CO2
to the child process and the child process computes whether the value is prime or not
and returns the result to the parent process using a different pipe. The parent process
prints the received result on the terminal. The communication between the parent and
the child is through the pipe.
Q B4 Assume that there are 5 processes, P0 through P4, and 4 types of resources. At T 0 we have 4 CO4
the following system state:
Max Instances of Resource Type A = 3 (2 allocated + 1 Available)
Max Instances of Resource Type B = 17 (12 allocated + 5 Available)
Max Instances of Resource Type C = 16 (14 allocated + 2 Available)
Max Instances of Resource Type D = 12 (12 allocated + 0 Available)
a. Apply Banker’s Algorithm whether the given system is in a safe state or not. If yes
find the safe states sequences.
b. If a request from process P4 arrives for (0 3 2 0), Can the request be granted
immediately?
SECTION-C
Consider the following set of processes, with the length of the CPU-burst time given in 8 CO3
milliseconds:
Process Arrival Time Burst Time
A 0 3
B 1 6
C 4 4
Q C1 D 6 2
E 2 5
F 3 9
Illustrate the execution of these processes with a Gantt chart using Round Robin (RR)
scheduling algorithm with a time quantum of 3ms. Also, find the average waiting time
and turnaround time.