0 0 votes Lets consider one situation where, OS is scheduling processes(P1,P2,P3...Pn) with Round Robin method and current running process is P1 and next scheduled process in queue is also P1 (this case is possible in Round Robin). Will a context switch occur after the quantum time is over? Provide reason behind your answer. Supporting Question: How many context switch will take place in Round Robin scheduling method with quantum=3unit for the given data below. AT=Arrival Time, BT=Burst Time Operating System operating-system process-scheduling round-robin-scheduling context-switch + – anupamsworld 2.6k views answer comment Share Follow Print See all 9 Comments 9 9 Comments reply Kabir5454 commented Jun 7, 2022 reply Follow flag @anupamsworld The case you are explaining is like this situation that there is one process P1 whose burst time is 10 unit time and time quantum is 5 unit so after 5 unit of time the process will context switch or not ? am i correct ? 0 0 replyShare anupamsworld commented Jun 7, 2022 reply Follow flag Absolutely correct, you are. 0 0 replyShare Kabir5454 commented Jun 7, 2022 reply Follow flag okay so for this case i belief no context switch occurs as we know context switch is a overhead and associated a cost with it so if i am operating system developer always try to minimize the cost . say we can implement it by keeping a variable process_count in ready queue , so after completion of each time quantum we check while(true) { if(process_count==1) run(one_time quantum); --------remaining code-------- } This is not the implementation but can be something like that so that for this case no context switch occurs. 0 0 replyShare anupamsworld commented Jun 7, 2022 reply Follow flag Well, my given situation is similar to as if there is only one process. But, there could be multiple processes in queue and the given situation may arise. In that case what will happen? 0 0 replyShare Kabir5454 commented Jun 7, 2022 reply Follow flag @anupamsworld can you specify the case? 0 0 replyShare anupamsworld commented Jun 7, 2022 reply Follow flag the case is specified in the question only. 0 0 replyShare anupamsworld commented Jun 7, 2022 reply Follow flag @Kabir5454 question is elaborated little more, please check. 0 0 replyShare Shaik Masthan commented Jun 7, 2022 reply Follow flag @Kabir5454, yes context switch between same process, is implemention defined. 1 1 replyShare AngshukN commented Jun 10, 2022 reply Follow flag Context switch would occur if there is another process in the ready queue waiting for the processor. Since there aren't any hence the dispatcher will not be invoked, in other words no context switch occurs .. imo. As for the second part, there would be 11 context switches considering the dispatching of the 1st process as a context switch from a previous process. P2 will execute for 4 seconds hence it will require two time quanta but context switch should not happen. .. again imo. 0 0 replyShare Please log in or register to add a comment.
1 1 vote 11 context switches , context switch at 0 and at termination is not considered (default) ajaycs_gate2023 answered Jul 1, 2022 ajaycs_gate2023 comment Share Follow 0 reply Please log in or register to add a comment.