Context Switch in Round Robin Scheduling ?


  • 0
    B

    If Only 1 Process is there . Then system will still do context switch or not.


  • 0
    T
    This post is deleted!

  • 0

    I guess no, context switch was invented for multiprocess computers


  • 2
    B

    Even when we have 1 process still context switch will happen in Round Robin .
    Round Robin is a scheduling Algorithm in which process share CPU in time sharing mode. So when the time quantum expires, process need to be context switch irrespective of number of process as process executes in running state and available processes are present in ready state.


  • 0

    @badalgupta9911103602 good point!


  • 0
    A

    Generally, Round Robbin is imeplemented with a queue. This queue maintains the order of execution of the process (FIFO). when a process finishes its time quantum and has remaining time for its complete execution ,it enters the queue(waiting) from the back. Since in this case the queue will be empty and this process will be the first as well as last one.
    We can say the process context switches with itself since there are no other process.


  • 0
    R

    @ashubeckham said in Context Switch in Round Robin Scheduling ?:

    ,it enters the queue(waiting) from the back. Since in this case the queue will be empty and this process will be the first as well as last one.

    @ashubeckham and @badalgupta9911103602 :
    Does it mean that even with only one process, context switching will happen for all scheduling mechanism which share CPU on time sharing method?
    Can you provide couple of examples of such scheduling algorithm


  • 0
    A

    @rujul Context switch depends on weather a process is preemptive or not . For example Shortest job first and Round Robbin are Preemptive and hence context switch will be take place in them . But in shortest job first context switch is based on weather there is process with less CPU burst time is available(in ready queue) ,If not then current process continue to execute.

    If you have any more doubts you can refer a book : Operating System Concepts ( by SILBERSCHATZ ,GALVIN and GAGNE).
    Thanks.


  • 4
    M

    This post explains it good.

    https://stackoverflow.com/questions/8997616/does-a-context-switch-occur-in-a-system-whose-ready-queue-has-only-one-process-a

    At different times, kernel will call the scheduler to select a new process to run. But it may turn out that the scheduler finds no other task but the currently running task. In that case scheduler will not undertake a "context switch" rather simply return by doing nothing.


  • 0
    W

    In most cases, an idle process is created when scheduler is started.
    Strickly speaking, the "Only" process should be the idle process, manless for a RR


Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.