0
votes

In round robin scheduling policy, suppose a process is running, and it's interrupted before its time slice ( the time which CPU is giving to every process) then what will happen?

example :

time slice : 3 ms .
P1 executes for 2 ms , and is interrupted ...
P2 starts ...

Question is when P1 comes next time for execution whether it will be given 3 ms or 4ms?

1

1 Answers

0
votes

when a process is interrupted before it's time slice :
Interruption can mean in 2 ways :
1) may be requiring I/O , so goes to waiting queue , CPU can execute another process.
2) may terminate due to an error , so is killed

In both cases , new process starts with it's time starting from 0 , example :
time slice : 3 ms .
P1 executes for 2 ms , and is interrupted ...
Now at t= 2ms , P2 starts executing and if it goes on smoothly , it wil be given 3ms .

EDIT
no , it will be given 3 ms only , may be after P2 is over , CPU may execute P3 and after I/O is done by P1 , it may go to ready queue , so next time CPU execute P1 , it gives it 3ms .