Write a monitor solution to the Readers/Writers problem.
Question 2:
Consider the following jobs:
Job # | Arrival time | Run time |
A B C D |
0 2 3 5 |
5 4 5 3 |
a) Using the SJF method, compute the completion times of the
above jobs, average turn around time and average waiting time.
b) Using the SRTF (Shortest Remaining Time first) method, compute
the the completion times of the above jobs, the average turn
around time and the average waiting time. Note that SRTF is
SJF with preemption.
Completion time - arrival time = turnaround time
c) Using the Round Robin method (with Quantum = 2), compute
the completion times of the above jobs and the average waiting
time.
Question 3:
What will be the number of page faults for the algorithms (FIFO,
LRU and Optimal) for the following page reference string:
1,2,3,3,5,1,2,2,6,2,1,5,7,6,3
for a memory with 4 frames?
Question 4:
There is a total of 15 units of R1 (resource 1) and 7 units
of R2 and the system is in the following state (again call it
S0):
Process | Max | Allocation |
P0 P1 P2 P3 |
R1 R2 4 2 5 7 4 6 6 4 |
R1 R2 2 2 4 1 3 1 3 2 |
a) Show that the above state is a safe state. You must come
up with a complete sequence of jobs.
b) If the system is in state S0, should a request of (2,0) units
by P2 be granted? You must give a sequence.
c) If the system is in state S0, should a request of (0,2) units
by P2 be granted? You must give a sequence.
d) If the system is in state S0, should a request of (2,0) units
by P3 be granted? You must give a sequence.
e) If the system is in state S0, should a request of (1,1) units
by P2 be granted? You must give a sequence.