CS 540 Operating Systems Test 2 - Name: Date: Thursday, April 25 ...
CS 540 Operating Systems Test 2 - Name: Date: Thursday, April 25 ...
CS 540 Operating Systems Test 2 - Name: Date: Thursday, April 25 ...
- No tags were found...
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
2. Suppose that the following processes arrive for execution at time 0 in the order A, B, C:Process Run Time PriorityA 6 2B 2 3 = lowC 4 1 = high(a) Draw four Gantt charts illustrating the execution of these processes using FCFS, SJF, a nonpreemptivepriority (a smaller priority number implies a higher priority), and RR (quantum = 2)scheduling.(b) What is the waiting time of each process for each of the scheduling algorithms?(c) What is the turnaround time of each process for each of the scheduling algorithms?(12 points)Ans:a. The four Gantt charts are0 6 8 12 0 2 6 12+---+-+--+ +-+--+---+| A |B| C| FCFS |B| C| A | SJF+---+-+--+ +-+--+---+0 4 10 12 0 2 4 6 8 10 12+--+---+-+ +-+-+-+-+-+-+|C | A |B| Priority |A|B|C|A|C|A| RR+--+---+-+ +-+-+-+-+-+-+b. Waiting time:| FCFS | SJF | Priority | RR---+------+-----+----------+----A | 0 | 6 | 4 | 6B | 6 | 0 | 10 | 2C | 8 | 2 | 0 | 6c. Turnaround time:| FCFS | SJF | Priority | RR---+------+-----+----------+----A | 6 | 12 | 10 | 12B | 8 | 2 | 12 | 4C | 12 | 6 | 4 | 103. Suppose we have 4 processes: A, B, C, and D. A must finish executing before B and C start. B and Cmust finish executing before D starts. Show your solution. Remember to indicate the initial value ofeach semaphore. (10 points)Ans:S1 S2A ----> B ----> D| ^| S3 S4 |+-----> C ------+Then, the processes may be synchronized using semaphores: