Operating System - Context Switch
Context switch is defined as switching the CPU from one process/thread to another and it requires performing a state save of current process/thread and a state restore of different process/thread.
An interrupt causes the OS to change CPU state from its current state to run another kernel routine. When an interrupt occurs, the system needs to save the current state of the process running on CPU, so that the context can be restored at the same point later. Usually the state or context is represented in the process control block (PCB) which includes CPU register, process state and memory information.