A context switch is the
computing process of storing and restoring the
state (
context) of a
CPU such that multiple
processes can share a single CPU resource. The context switch is an essential feature of a
multitasking operating system. Context switches are usually computationally intensive and much of the design of
operating systems is to optimize the use of context switches. A context switch can mean a register context switch, a task context switch, a thread context switch, or a process context switch. What constitutes the context is determined by the processor and the operating system.
See more at Wikipedia.org...
<
operating system> When a
multitasking operating system stops running one
process and starts running another. Many operating systems implement concurrency by maintaining separate environments or "contexts" for each process. The amount of separation between processes, and the amount of information in a context, depends on the operating system but generally the OS should prevent processes interfering with each other, e.g. by modifying each other's memory.
A context switch can be as simple as changing the value of the
program counter and
stack pointer or it might involve resetting the
MMU to make a different set of memory
pages available.
In order to present the user with an impression of parallism, and to allow processes to respond quickly to external events, many systems will context switch tens or hundreds of times per second.
(1996-12-18)