4,443 views
8 votes
8 votes
If we have only one process in ready queue with burst time "m", then how many context switching will happen using round robing scheduling with time quantum q ,where q<m.Assume that dispatching the process first time is not counted as  a context switch.

6 Answers

Best answer
6 votes
6 votes
It clearly says " .Assume that dispatching the process first time is not counted as  a context switch."

so number of context switch = 0

as there is only one single process.
selected by
5 votes
5 votes

ROUND ROBIN Single Process - Number of Context Switches

In Operating System Concepts, Galvin, Ed. 9th, page 273, below figure 6.4. (Section 6.3.4 Round-Robin Scheduling) Paragraph says that - 

Assume, for example, that we have only one process of 10 time units. If the quantum is 12 time units, the process finishes in less than 1 time quantum,with no overhead.

If the quantum is 6 time units, however, the process requires 2 quanta, resulting in a context switch. If the time quantum is 1 time unit, then nine context switches will occur, slowing the execution of the process accordingly(Figure6.4). 

Clearly, Book doesn't count first time and last time as context switches (if question doesn't mention anything whether to take or not in that case, default mode). In single process, round robin scheduling, they are counting context switches after time quantum expires.

But the other answers or comment based on this link.

Well, I think it is implemented code. Different implementation can have different things and they can modify algorithm or improve it for performance.

Now for actual question.

burst time is - m units (let 10) ,  time quantum - q units (let 5 or 6 or 4) , q<m

$\left \lceil \frac{m}{q} \right \rceil - 1$

Related questions

1 votes
1 votes
1 answer
2
sanyam53 asked Jan 7, 2017
1,653 views
How many time context switch in Round Robin? ( if only one process remain in ready queue at end of scheduling does that count every time, when time slice over or only one...