📑 Table of Contents

In computer operating system design, kernel preemption is a property possessed by some kernels, in which the CPU can be interrupted in the middle of executing kernel code and assigned other tasks (from which it later returns to finish its kernel tasks).

Details

edit

Specifically, the scheduler is permitted to forcibly perform a context switch (on behalf of a runnable and higher-priority process) on a driver or other part of the kernel during its execution, rather than co-operatively waiting for the driver or kernel function (such as a system call) to complete its execution and return control of the processor to the scheduler when done.[1][2][3][4] It is used mainly in monolithic and hybrid kernels, where all or most device drivers are run in kernel space. Linux is an example of a monolithic-kernel operating system with kernel preemption.

The main benefit of kernel preemption is that it solves two issues that would otherwise be problematic for monolithic kernels, in which the kernel consists of one large binary.[5] Without kernel preemption, two major issues exist for monolithic and hybrid kernels:

  • A device driver can enter an infinite loop or other unrecoverable state, crashing the whole system.[1]
  • Some drivers and system calls on monolithic kernels can be slow to execute, and cannot return control of the processor to the scheduler or other program until they complete execution.[2]

See also

edit

References

edit
  1. ^ a b "Preemption under Linux". kernelnewbies.org. 2009-08-22. Retrieved 2016-06-10.
  2. ^ a b Jonathan Corbet (2003-02-24). "Driver porting: the preemptible kernel". LWN.net. Retrieved 2016-06-10.
  3. ^ "FreeBSD Architecture Handbook, Chapter 8. SMPng Design Document, Section 8.3. General Architecture and Design". freebsd.org. Retrieved 2016-06-10.
  4. ^ Robert Love (2002-05-01). "Lowering Latency in Linux: Introducing a Preemptible Kernel". Linux Journal. Retrieved 2016-06-10.
  5. ^ Robert Love (2010). Linux Kernel Development (3 ed.). Pearson Education. ISBN 978-0672329463.

📚 Artikel Terkait di Wikipedia

Linux kernel

specific user. Linux provides both user preemption as well as (selectable, up to) full kernel preemption. Preemption reduces latency, increases responsiveness

Linux kernel version history

the kernel's preemption models (part 1)". LWN.net. Retrieved 31 May 2026. Corbet, Jonathan (2 October 2023). "Revisiting the kernel's preemption model

Comparison of operating system kernels

July 27, 2010. Retrieved 2026-04-04. The kernel's command-line parameters. kernel.org. A realtime preemption overview. LWN. August 10, 2005 A proxy-execution

Preemption (computing)

In computing, preemption is the act performed by an external scheduler — without assistance or cooperation from the task — of temporarily interrupting

NetBSD

sets). The kernel and userland for these platforms are all built from a central unified source-code tree managed by CVS. Unlike other kernels such as μClinux

PREEMPT RT

maintainers to focus on refactoring kernel subsystems and pushing critical real-time code into the mainline. In 2021, the preemption core locking code was merged

Synchronization (computer science)

read-copy-update (RCU). Enabling and disabling of kernel preemption replaced spinlocks on uniprocessor systems. Prior to kernel version 2.6, Linux disabled interrupt

MontaVista

to the Linux kernel in 2001. The Linux 2.6 stable kernel series is the first to include similar features, such as priority-based preemption. As of 2008