Actions taken by a kernel to context-switch between processes


Actions taken by a kernel to context-switch between processes are -

  • The OS must save the PC and user stack pointer of the currently executing process, in response to a clock interrupt and transfers control to the kernel clock interrupt handler

  • Saving the rest of the registers, as well as other machine state, such as the state of the floating point registers, in the process PCB is done by the clock interrupt handler.

  • The scheduler to determine the next process to execute is invoked the OS.

  • Then the state of the next process from its PCB is retrieved by OS and restores the registers. The restore operation takes the processor back to the state in which the previous process was previously interrupted, executing in user code with user-mode privileges.

Many architecture-specific operations, including flushing data and instruction caches also must be performed by Context switches.

Updated on: 16-Oct-2019

7K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements