Log In
0 votes


Why P1 is still running after 2ms, shouldn't P2 get the cpu burst? In the video they said that are are no processes present other than P1 when the timer interrupts after 2 time slices. Isn't the gantt chart wrong. What i am missing here, can anyone explain it right?

in Operating System 188 views
yes you are correct its wrong only ...

After P1 we should have have P2 but they have allocated P2 which is not correct

what is the time quantum ? is it 2?

if it is 2, then P1 ( after completing 1st time ) and P2 both are entered into the queue at the same time ( at time=2 )

then it is implementation defined " which one get into the ready queue first. "


yes the time quantum is 2.Since a process is alotted this fixed time, and after 2ms(or whatever the time unit is), process P2 has arrived in the queue, so the scheduler will preempt P1 and push it in the queue after process P2, and process P2 will run for the given time quantum.  The ready queue for first 4 time units will look as :

P1 P2 P1....  when P2 runs P3 arrives before its alloted time has finished...and the queue will be :   

P1 P2 P1 P3.

Hence shouldn't the gantt chart be like this :


brother, read my comment clearly...

note that, at t=2, P1 and P2 both enters into the ready queue at a time. You can't say P2 is coming first and P1 is coming next.
so that's why P1 is continuing to run... P1 is already running and P2 arrives... and the cpu doesn't want a context switch overhead?
actually context switch occurs but again P1 only choosen ( it is implementation defined. )
okk.. i think im getting it.. P1 is already there first at t=2, but i think i've seen examples like this where the other processes are scheduled first.. dont know for sure. can i ask for the source of this implementation.

And thank you so much for replying and clearing doubts.
implementation defned means, while writing program of OS, the programmer write it.

Please log in or register to answer this question.

Related questions

2 votes
0 answers
Consider a system having $10$ IO bound jobs and $1$ CPU bound job.. If IO bound job issue an IO request once for every ms of CPU computation and that each IO request takes $10$ ms. If context switch overhead is $0.1$ ms.Using round -robin scheduling with a time quantum of $10$ ms. , the CPU efficiency is __________________
asked Mar 11, 2019 in Operating System srestha 305 views
6 votes
1 answer
Measurements of a certain system have shown that a process runs, on the average, for time T before blocking for Input/Output. Process switch requires time S which is overhead. For round robin scheduling with quantum Q, give a formula for the cpu efficiency in each of the ... goes to 0 Can somebody please explain option c and hence option D with example ,Thanks and sorry if it is naive question :)
asked Nov 15, 2017 in Operating System sunil sarode 4.1k views
3 votes
2 answers
Consider a System using Round Robin scheduling with 10 Processes all arriving at the time 0. Each Process is associated with 20 identical Request. Each Process request consumes 20 ms of CPU time after which it spends 10 ms of time on I/O,thereafter intiates subsequent ... Process. ii. Response time of the 1st Request of the last Process. iii. Response time of the subsequent request of any process.
asked Aug 22, 2018 in Operating System Karan Dodwani 1 1k views