liveBook · Manning

Preemption

Preemption is the interruption or displacement of active execution or resource allocation so another eligible activity can proceed.

How 5 Manning books explain it

Grokking Concurrency

Preemptive multitasking is an operating-system technique in which the system can suspend a running task without requiring its cooperation and schedule another task.

How it is used
Keeps applications and threaded I/O services responsive by switching CPU time among tasks without requiring them to yield.
How deep it goes
Explains time slices, scheduler interrupts, and task switching, then sketches the behavior in Python rather than implementing an operating-system scheduler.
Examples
Illustrates timer-driven arcade tasks and a Python socket server with one thread per client.
What you can do after
Apply it via Python threads to serve concurrent clients while leaving thread scheduling to the operating system.

Read how Grokking Concurrency explains preemption →

Kubernetes for Developers

Preemption is the proactive removal of lower-priority Pods to make resources available for higher-priority Pods.

How it is used
Uses priority-based displacement to schedule important workloads during temporary cluster capacity shortages.
How deep it goes
Explains PriorityClass configuration, scheduling effects, rescheduling behavior, and placeholder capacity, but not detailed eviction algorithms.
Examples
Uses high-priority Deployments, non-preempting PriorityClasses, and low-priority placeholder Deployments to demonstrate displacement.
What you can do after
Configure preemptive and non-preemptive PriorityClasses and operate placeholder Deployments for rapid scheduling headroom.

Read how Kubernetes for Developers explains preemption →

100 Go Mistakes and How to Avoid Them

Preemptive scheduling is a scheduling model in which the scheduler can interrupt an executing task and replace it with another task.

How it is used
Explains how Go shares CPU time among goroutines and keeps long-running work from monopolizing execution.
How deep it goes
Defines preemption, contrasts it with cooperative scheduling, and gives an approximate 10 ms threshold without detailing runtime internals.
Examples
Uses long-running work, parallel merge sort, runnable queues, and a four-core goroutine-state diagram.
What you can do after
Evaluate whether CPU-bound goroutines can share execution without explicit blocking operations.

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

Elixir in Action, Third Edition

Preemptive scheduling is a scheduling method that interrupts running processes to switch execution to other runnable processes.

How it is used
Maintains responsiveness by preventing long-running Erlang processes from monopolizing execution.
How deep it goes
Explains execution windows, pauses, context switches, and load behavior without detailing scheduler implementation internals.
Examples
Illustrates long-running processes, waiting I/O operations, rising request load, and the Erlang virtual machine.
What you can do after
Evaluate/understand how BEAM scheduling limits blocking and shapes performance under increasing load.

Read how Elixir in Action, Third Edition explains preemption →

Python Concurrency with asyncio

Preemptive multitasking is a scheduling technique in which the system forcibly pauses running tasks according to its scheduling policy.

How it is used
Frames operating-system scheduling as a way to run multiple tasks concurrently through time slicing.
How deep it goes
Defines time slicing and contrasts cooperative scheduling, but defers operating-system internals.
Examples
Demonstrates scheduling with ProcessPoolExecutor tasks that count to several small values and one large value.
What you can do after
Evaluate whether concurrent work is concurrent only or also parallel, and recognize process- and thread-based implementations.

Read how Python Concurrency with asyncio explains preemption →

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.