a Five processes P1 P2 P3 P4 and P5 arrive at times 2 3 4 6

(a) Five processes P1, P2, P3, P4, and P5 arrive at times 2, 3, 4, 6, and 10 respectively. Their CPU bursts are 12, 6, 5, 6, 8, and 7 respectively. With a time slice of 4 time units, use RR scheduling. (a) Draw the execution diagram. (b) Calculate the average wait time. (c) Calculate the CPU utilization.

Solution

a) GANTT Chart of Round Robin Scheduling

Quantum =4

|****| P1 | P2 | P3 | P4 | P5 | P1 | P2 | P3 | P4 | P5 | P1 |

0 2 6 10 14 18 22 26 28 29 31 35 39

In the order the processes arrives they are given quantum =4 time slice each

P1 4

P2 4

P3 4

P4 4

P5 4

P1 4

P2 2 P2 Finishes

P3 1 P3 Finishes

P4 2 P4 Finishes

P5 4 P5 Finishes

P1 4 P1 Finishes

(b) Wait time of process = total time it waits - arrival time

Average wait time= ((35-2)+(26-3)+(28-4)+(29-6)+(31-10))/5 = 124/5 = 24.8 ms

(c) CPU utilization

every task uses 4msec to do work and .1msec to switch; thus, it is spending 4 of every 4.1 ms doing work.

The time quantum is 4 millisecond: Irrespective of which process is scheduled, the scheduler incurs a 0.1 millisecond context-switching cost for every context-switch.

So CPU utilization = 4/(4+0.1) * 100 = 97%.

(a) Five processes P1, P2, P3, P4, and P5 arrive at times 2, 3, 4, 6, and 10 respectively. Their CPU bursts are 12, 6, 5, 6, 8, and 7 respectively. With a time

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site