You are on page 1of 3

Process Name Process ID Arrival Time Burst Time

P1 0 12
P2 1 3
P3 2 3
All process arrived at time 0

Time Quantum: 4 milliseconds

First form a Ghant chart

P1 will get the CPU at 0 milliseconds


P1 will be executed 4 milliseconds
From 0-4
And after that P1 will be preempted
And the CPU will be given to the next process

P2 now gets the CPU


P2 will be allowed to execute for 4 milliseconds
P2 burst time is less than the Time quantum
So, it only executes for only 3 milliseconds
From 4-7
P2 voluntarily release in the CPU

At 7 milliseconds will be assigned in the queue


P3 gets the CPU at 7 milliseconds
P3 will be allowed to execute for 4 milliseconds
P3 burst time is less than the Time quantum
So, it only executes for only 3 milliseconds
From 7-10
P3 voluntarily release in the CPU

P1 was preempted and put in the last queue


At 10 milliseconds will be assigned in the queue
P1 gets the CPU at 10 milliseconds
P1 will be allowed to execute for 4 milliseconds
From 10-14

P1 have remaining 4 millisecond and put again in the queue


At 14 milliseconds
P1 was preempted and put in queue again
At 14 milliseconds will be assigned in the queue
P1 gets the CPU at 14 milliseconds
P1 will be allowed to execute for 4 milliseconds
From 14-18

0 4 7 10 14 18 - Completion time

P1 P2 P3 P1 P1

Turn Around Time = Completion Time – Arrival time

Waiting Time = Turn Around Time – Burst time

Process Process Arrival Completion Turn Burst Waiting


Name ID Time Time Around Time Time
Time
P1 0 18 – 0 18 12 - 18 6

P2 0 7-0 7 7-3 4

P3 0 10 - 0 10 10 -3 7

Average Turn Around Time

= (18 + 7 + 10) / 3

= 35 / 3

= 11.66 ms

Average waiting Time

= (6 + 4 + 7) / 3

17 / 3 = 5.66 ms

You might also like