Does a context switch occur in a system whose finished queue has only one process and uses cyclic scheduling?

Does a context switch occur in a system whose finished queue has only one process and uses cyclic scheduling?

Assume that the current processor package of a single process spans more than one time fragment of the round-robin algorithm.

My reasoning below

The steps that can take place when a timer interrupt occurs in a typical case are

  • Interruption occurs. Switching to kernel mode
  • OS saves current context in PCB (saves registers, process status and memory management information of current process)
  • Perform many architecture-related operations, including flushing data and instruction caches and TLBs.
  • Put the current process in a readiness queue
  • Select a new process to execute.
  • Download context from the circuit board of this process.
  • . .

, , . , . , , Q , .

, ? , ?

, ?

- , , . , .

, , , . , stackoverflow.

+5
1

Linux . ​​ , . , , . " ", , .

, Linux

   .........
   if (likely(prev != next)) {<-- if next and current are same, then no context switch
            sched_info_switch(prev, next);
            perf_event_task_sched_out(prev, next);

            rq->nr_switches++;
            rq->curr = next;
            ++*switch_count;

            context_switch(rq, prev, next); /* unlocks the rq */
            /*
             * The context switch have flipped the stack from under us
             * and restored the local variables which were saved when
             * this task called schedule() in the past. prev == current
             * is still correct, but it can be moved to another cpu/rq.
             */
            cpu = smp_processor_id();
            rq = cpu_rq(cpu);
    } else {
     ............
+7
source

All Articles