Context Switch

Noun · Development

Definitions

  1. The process of saving one thread/process's state (registers, program counter, stack pointer) and loading another's so the CPU can switch between tasks. Costs 1-10 microseconds on modern hardware. Excessive context switching (from too many threads or frequent I/O) degrades performance. Also used metaphorically for human task-switching costs.

    In plain English: The overhead of the CPU switching between different tasks, saving and restoring each task's state.

    Example: "Running 1,000 OS threads causes constant context switching — use async I/O or a thread pool to keep it under control."

Related Terms