Glossary Updates12 new terms added to the glossaries · October 2, 2026, 22:44 CEST
AI TechDocKnowledge

Glossary · Automation software engineering and architecture

Context switch

Also known as: Task switch

German: Kontextwechsel

In operating systems and real-time software, a context switch is the process of saving the state of the currently running task, thread or process, such as its registers and stack pointer, and restoring the state of another one so the processor can continue executing it.

  • Software engineering

In one sentence

A context switch saves the state of the running task and restores another one's, so the processor can switch between tasks.

Example

When the 1 ms motion task becomes ready, the real-time kernel performs a context switch from the lower-priority logic task, which resumes after the motion task finishes.

How it applies

  • Engineering: Each context switch costs processor time and can disturb caches. Frequent switches add overhead and contribute to Execution jitter. Real-time operating systems keep switch times short and bounded.
  • Design: Task priorities and cycle times determine how often switches occur. Too many tasks, or tasks with very short cycles, can consume a noticeable share of the processor.
  • Documentation: For performance-critical systems, document the task model and measured timing, including worst-case context switch and interrupt latency where the platform vendor specifies them. This supports later extensions and troubleshooting of timing problems.

Preemptive vs. cooperative switching

In preemptive scheduling, the kernel can switch tasks at any time, for example when a higher-priority task becomes ready. In Cooperative scheduling, a task gives up the processor voluntarily. Preemption gives better response times for urgent tasks but requires protection of shared data.

By knowledge.aitechdoc.world · Published September 26, 2026 · Last reviewed

Source: AI TechDoc Knowledge editorial definition, based on operating systems and real-time computing practice

Definitions follow the cited standards and specifications. Where a source is a copyrighted publication, such as an ISO, IEC or EN standard, the definition is a close paraphrase, not a verbatim quotation, so as not to infringe copyright. We recommend reading the original publication. The sections “How it applies” are editorial commentary by AI TechDoc Knowledge and are not part of any standard.

Seen a mistake? Send us a note!