in Operating System
4,420 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.
in Operating System
4.4k views

4 Comments

what will happen if there are n processess is it $(m/q)^{n}$????.correct me if i am wrong.
1
1
but don't you think that once the process starts executing then the ready queue will be empty as there is only one process in the system?
0
0
i think only 0 Context switching
0
0

6 Answers

6 votes
6 votes
Best answer
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

1 comment

Sir, but in galvin under the topic of RR there as diagram which shows that CS can take place with just one process too.
2
2
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$

3 votes
3 votes
It will not context switch since only one process is there . So ans is 0.

1 comment

0
0
1 vote
1 vote
ceil(m/q)-1 will be the answer

Related questions