The action taken by a kernel to context switch between
processes are --
- To switch CPU to other process, it has requirement of
performing a state save of the current process and state restore of
different process. this task is called as context
switching.
- When the context switching ocuur the kernel switching
context of old process in PCB and loads saved
context of new process scheduled to run.
- context switch time is pare overhead because
system do not have any useful work during that time.
- It depend on the processor which have large number of
register so it do not need to unload old
PCB because it has enough space to store frequently used
processes PCB.
- The Operating system need to save the PC and user stack
pointer for the process which is currently executing
process, in response to clock interrupt and transfer control to
kernel clock interrupt handler.
- The clock interrupt handler which save rest of register
and other machines state of floating pointer register in process
PCB.
- then the operating system identify schedule and determine next
process to be execute.
- Then the operating system retrives the state of next process
from PCB and and restore the register.