Show in graph
OS

Software → Operating Systems

Context Switch

The operation of saving one execution context and restoring another so the CPU can switch tasks.

Motivation

Context switch solves the problem of sharing one CPU core among multiple execution contexts.

Where it fits

Context Switch belongs to operating systems and concurrency.

Mental model

The OS saves the current execution state and restores another one, creating the illusion of simultaneous progress.

Common mistakes

  • Assuming context switching is free.
  • Confusing concurrency with parallelism.

Context Switch connects to thread, process, scheduler, multitasking, and latency.