Restartable Sequences: A Linux Kernel Feature for Lock-Free Thread-Safe Programming
By
grappler
Fresh out the oven, still warm. Top of the tray.
Summary
This article explores restartable sequences (rseq), a Linux kernel feature introduced in version 4.18 (circa 2018) that enables creation of thread-safe data structures without traditional locks or atomic operations, scaling efficiently to many-core microprocessors. The author notes that rseq currently requires handwritten assembly code on Linux, but predicts a future where all operating systems support rseq(), all system programming languages are redesigned to express restartable sequences, and all software is rewritten to use them.
Key quotes
· 4 pulledThe best kept secret at the frontier of system programming right now is the Linux 4.18+ (c. 2018) concept of restartable sequences or rseq for short.
They allow you to create thread-safe data structures without locks or atomics which scale to microprocessors with many cores.
It's currently only possible to use rseq on Linux using handwritten assembly code.
I believe in the future, all operating systems will be updated to support rseq(), all system programming languages will be redesigned to be able to express restartable sequences
You might also wanna read
Linux Kernel /proc/*/mem Pseudofile: Understanding Punch Through Semantics for Unwritable Memory
This article explores the Linux kernel's /proc/*/mem pseudofile and its unique 'punch through' semantics that allow writes to succeed even w
Linux Kernel Development: Introducing the Swap Table for Modernized Memory Management
The article discusses a new Linux kernel feature called the 'swap table' that aims to modernize the swap subsystem. The swap subsystem is de
Challenges of Implementing Linux Kernel's READ_ONCE() and WRITE_ONCE() Macros in Rust
The article discusses the challenges of implementing READ_ONCE() and WRITE_ONCE() macros from the Linux kernel in Rust code. These macros ar
Zig Days: Collaborative Full-Day Programming Events for the Zig Community
Zig Days are full-day collaborative programming events organized by the Zig community, typically held on Saturdays. Participants meet in the
Spectre Programming Language Documentation: A Contract-Based Approach to Safe Low-Level Systems Programming
Spectre is a contract-based programming language designed for safe low-level systems programming. It enforces correctness through type-level
Linux kernel patch proposes per-function "killswitch" for runtime short-circuit mitigation
A Linux kernel patch proposal by Sasha Levin introduces a "killswitch" mechanism — a per-function short-circuit mitigation primitive designe
