consider three processors P1,P2,and P3 in memory P1 takes 5,P2 takes 3 and P3 takes12 to complete its execution.what is the total round time if they are executed in time shared OS environment having 4 for each clock cycle?
Answers
Answer:
The total turn around time = 12+7+20 = 39 sec
The average turn around time = 39/3 = 13 sec
Explanation:
Let the 3 processors and their respective executable times (let us consider the time in seconds) are:
P1 - 5 sec
P2 - 3 sec
P3 - 12 sec
and given, time quantum= 4 sec
Round Robin Algorithm:
On changing the processor and process for every 4 sec,
The Gantt Chart will be as follows:
0 P1 4 P2 7 P3 11 P1 12 P3 16 P3 20
For every processor in the chart, the left one denotes the waiting time and the right one denotes the turn around time.
Calculating the total and average turn around time:
Turn around time of processor P1: 12 sec
Turn around time of processor P2: 7 sec
Turn around time of processor P3: 20 sec
Therefore,
The total turn around time = 12+7+20 = 39 sec
The average turn around time = 39/3 = 13 sec