<P> In computing, a context switch is the process of storing the state of a process or of a thread, so that it can be restored and execution resumed from the same point later . This allows multiple processes to share a single CPU, and is an essential feature of a multitasking operating system . </P> <P> The precise meaning of the phrase "context switch" varies significantly in usage . In a multitasking context, it refers to the process of storing the system state for one task, so that that task can be paused and another task resumed . A context switch can also occur as the result of an interrupt, such as when a task needs to access disk storage, freeing up CPU time for other tasks . Some operating systems also require a context switch to move between user mode and kernel mode tasks . The process of context switching can have a negative impact on system performance, although the size of this effect depends on the nature of the switch being performed . </P> <P> Context switches are usually computationally intensive, and much of the design of operating systems is to optimize the use of context switches . Switching from one process to another requires a certain amount of time for doing the administration--saving and loading registers and memory maps, updating various tables and lists, etc . What is actually involved in a context switch varies between these senses and between processors and operating systems . For example, in the Linux kernel, context switching involves switching registers, stack pointer, and program counter, but is independent of address space switching, though in a process switch an address space switch also happens . Further still, analogous context switching happens between user threads, notably green threads, and is often very light - weight, saving and restoring minimal context . In extreme cases, such as switching between goroutines in Go, a context switch is equivalent to a coroutine yield, which is only marginally more expensive than a subroutine call . </P> <P> There are three potential triggers for a context switch: </P>

In a microkernel os the process scheduler may run as a user process