0
votes

What will be the gantt chart for round robin scheduling with time quantum ?

Click here for, Process Details

Process Arrival Time Burst Time
P1  0 3
P2  1 3
P3  2 3

Time quantum : 1 units

According to me, following should be the gantt chart. Please verify.

Gantt Chart Image

Doubt :

  1. What happens if P1 ( scheduled) and P2 (new Process) arrives at the same Time T. Which of these will be scheduled next ?

    eg. P1 is scheduled from Time T0 to T1. P2 arrives at Time T1. Now at Time T1 both P1 and P2 is present to be scheduled. Which one will execute next ?

  2. I read that Process is always inserted at the end of Waiting Queue ?

According to these points what should be the correct answer ?

Please help me in understanding the Algorithm.

Thanks

2
If you are down-voting the question then at least give a valid reason !!!maddy man

2 Answers

0
votes

Following gantt chart depicts the process to be allocated to CPU at each time instant.

Gantt Chart

It may be seen that at time instant 1, two processes are available P1 (just allocated to CPU but with remaining burst time) and P2 (just arrived). P2 will be added to the ready queue followed by P1 at the tail. Same explanation holds whenever there is a conflict giving preference to newly arrived process to be added to tail followed by process which has been just allocated to CPU with remaining burst time.

0
votes

enter image description here

For each process have a specific time period for execution program , which means 1 unit. each process has 3 units of burst time.

At T0 point P1 is available for execution. When it starts at T0 time and it will execute until T1 time (Because each round has 1 unit of time period).

At T2 time , P2 will be available for execution. After that in T2 time , the P2 process will starts execution.When it starts at T2 time and it will execute until T3 time.

At T3 time , P3 will be available for execution.After that in T3 time , the P3 process will starts execution.

After the P3 , it will directly jumped into the next round of execution.

Let's check about waiting time of each process

P1 => 4 Units P2 => 5 Units P3 => 6 Units

Average waiting time = (4+5+6)/3 = 5 Units