liveBook · Manning

Context switching

A context switch is a transition from one active task or context to another, involving a change in execution state or attention.

How 9 Manning books explain it

Learn Concurrent Programming with Go

A context switch saves one task's execution state and restores another's so processor execution can move between tasks, threads, or goroutines.

How it is used
Explains how schedulers share CPU time among jobs, threads, and goroutines to support concurrent execution.
How deep it goes
Defines saved process state, switching overhead, kernel and user-level management, and Go yield behavior without detailing scheduler selection algorithms.
Examples
Uses a text-search job lifecycle and a Go `sayHello` program calling `runtime.Gosched()`.
What you can do after
Evaluate/understand why concurrent work appears interleaved and why Go programs cannot rely on a chosen goroutine running next.

Read how Learn Concurrent Programming with Go explains context switching →

Latency

Context switching is the process of saving one execution context and loading another so multiple processes or threads can share a CPU core.

How it is used
Frames context switching as both the mechanism for sharing a core and a source of latency variance.
How deep it goes
Explains saved state, microsecond-scale costs, cache effects, and mitigations without detailing kernel scheduler implementation.
Examples
Illustrates three threads taking four-millisecond turns on one core and shows thread creation with Rust’s std::thread::spawn().
What you can do after
Diagnose/debug with it by distinguishing scheduling delay from switch overhead and considering thread count, affinity, and priority.

Read how Latency explains context switching →

100 Go Mistakes and How to Avoid Them

Context switching is the act of suspending one execution context and resuming another on a processor or runtime worker.

How it is used
Explains scheduling costs and guides goroutine-pool sizing for concurrent Go workloads.
How deep it goes
Explains saved thread state, goroutine-to-thread switching, scheduler states, and workload effects, but does not prescribe a universal pool size.
Examples
Uses four-core scheduling diagrams, a fixed worker pool, a shared channel, and a GOMAXPROCS query.
What you can do after
Build CPU-bound worker pools, reduce avoidable switching, and validate concurrency assumptions with benchmarks.

Read how 100 Go Mistakes and How to Avoid Them explains context switching →

C# Concurrency: Asynchronous and multithreaded programming

A context switch is the act of saving one thread's execution state and loading another thread's state so the processor can run it.

How it is used
Explains how multithreading shares CPU time and why asynchronous techniques avoid unnecessary waiting.
How deep it goes
Explains state saving, restoration, timer-driven switching, blocked states, and overhead without presenting implementation code.
Examples
Uses a multitasking cook, pizza timers, file reads, network access, and multiple request flows.
What you can do after
Evaluate why thread switching costs resources and when nonblocking asynchronous work can release a waiting thread.

Read how C# Concurrency: Asynchronous and multithreaded programming explains context switching →

Grokking Concurrency

Context switching is the operating-system procedure of saving one task's execution state and restoring another task's state so execution can be transferred between them.

How it is used
Explains how the operating system enables multitasking by interleaving task execution on available processor resources.
How deep it goes
Defines saved execution state and scheduler transitions, then contrasts switching costs for CPU-bound and I/O-bound work.
Examples
Uses a phone-call interruption and task states such as Ready, Running, and Blocked to make switching behavior concrete.
What you can do after
Evaluate when task switching helps responsiveness and when its overhead can degrade application performance.

Read how Grokking Concurrency explains context switching →

The Creative Programmer

The shift from one active task, system, language, or conceptual framework to another, including the effort required to resume the original context.

How it is used
Frames interruptions and language changes as productivity risks, then turns awareness, preparation, and focused intervals into practical responses.
How deep it goes
Explains cognitive costs through CPU and train-of-thought analogies, gives timing practices, and stops short of definitive productivity claims.
Examples
Uses cross-language syntax slips, CPU interrupts, a crashing train of thought, email during builds, and timed work intervals.
What you can do after
Apply it via the Pomodoro technique, distraction reduction, goal monitoring, preparation, and deliberate verification during language changes.

Read how The Creative Programmer explains context switching →

Architecture Modernization: Socio-technical alignment of software, strategy, and structure

Context switching is the cognitive and operational disruption caused by repeatedly changing between different tasks, teams, or work contexts.

How it is used
Manages team cognitive load and protects modernization focus by reducing repeated movement between initiatives, subdomains, and teams.
How deep it goes
Explains disruption and mitigation through boundaries, knowledge handover, emergency callbacks, and staffing decisions, without prescribing a fixed process.
Examples
Uses a split-week developer arrangement and a Core Domain Chart to make disruption and overloaded boundaries visible.
What you can do after
Diagnose overloaded team boundaries and redesign staffing so modernization work receives sustained attention.

Read how Architecture Modernization: Socio-technical alignment of software, strategy, and structure explains context switching →

Software Design for Python Programmers

Context switching is the operating-system or runtime operation of saving one thread's execution state and restoring another's so execution can alternate between them.

How it is used
Explains how multithreaded programs alternate work and why concurrency does not necessarily provide parallel execution.
How deep it goes
Explains switching, resource sharing, and performance costs, but stops short of detailed operating-system implementation steps.
Examples
Uses a dinner-party analogy and a three-thread application sharing memory, files, printers, stacks, and registers.
What you can do after
Evaluate multithreaded performance by weighing context-switching overhead against the benefits of additional threads.

Read how Software Design for Python Programmers explains context switching →

Object-Oriented Software Design in C++

Context switching is the operating-system operation of saving one thread's execution state and restoring another's so execution can move between them.

How it is used
Explains how operating systems create concurrent execution and frames the synchronization demands of multithreaded design.
How deep it goes
Defines switching and contrasts concurrency with parallelism, then stops short of describing the saved execution state or switching mechanism.
Examples
Uses a dinner-party analogy and a three-thread resource-sharing figure to illustrate concurrency, parallelism, and thread-local runtime resources.
What you can do after
Evaluate multithreaded designs by weighing synchronization, scheduling unpredictability, deadlocks, and context-switching overhead.

Read how Object-Oriented Software Design in C++ explains context switching →

Related concepts

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.