Linux Futex Redesign Would Wake Waiting Threads in Parallel
The article's text, from Joho no Todai's page.
On December 2, 2026, researchers at France's National Institute for Research in Digital Science and Technology (Inria) published a paper on improving futexes, which Linux uses for thread synchronization. The paper, "Lightning-Speed Futexes," presents a new design implemented on top of Linux 6.19.
When threads share a computation, they may have to wait until each one has reached a defined point before moving to the next step together. This is called barrier synchronization.
Linux futexes help implement synchronization and mutual exclusion. With no contention, locks can be acquired and released in user space. The kernel gets involved when a thread needs to sleep or wake up.
According to the technical explanation in the paper, waking a group of waiters in Linux 6.19 starts with one thread acquiring the lock that protects the wait list. It finds which threads to wake, releases the lock, and returns those threads to a runnable state one at a time. The basic structure of that wake-all operation has remained in place since futexes were introduced in 2002, the researchers say.
The researchers ran repeated barriers without any intervening computation on six servers with Intel, AMD, and Arm-based CPUs. The servers had 80 to 512 hardware threads. Going from two software threads to using all hardware threads made each barrier take 11 to 63 times as long on the Linux 6.19 baseline, depending on the machine.
Adding CPU cores lets more threads compute in parallel, while the work of waking them still happens serially. That leaves room to improve how many-core processors are used.
Letting threads leave the lock queue when they no longer need to wait
In a glibc barrier, when the last thread arrives, it updates the value that represents the synchronization condition and starts waking sleepers. Threads still trying to add themselves to the wait list may already be queued for a lock in the kernel.
Once the condition is met, those threads no longer need to sleep at that barrier. In the existing implementation, they wait for the lock before they can check the value again. The thread responsible for waking sleepers queues for the same lock, delaying the wakeups that are still needed.
Linux 6.19 private futexes: synchronization improvements
| Operation | Linux 6.19 | Research prototype |
|---|---|---|
| Lock acquisition | Acquired in order | Cancel earlier requestsin one batch |
| Identify waiters | Check one at a time | Detach in bulk when eligible |
| Wake all waiters | Wake one thread at a time | Threads that have wokenhelp with remaining wakeups |
| Longest wakeup path | Grows with thenumber of waiters | Grows with the logarithm of the waiter count |
| Requirements for bulk detachment and parallel wakeups | ||
| All waiters in the bucket share a futex key and wake bitset, and all must be eligible.Waiter count must be no higher than the CPU's hardware thread count.。 | ||
The researchers put an Abort Gate in front of the lock. When a wake-all request arrives, the gate cancels queued lock requests in a batch. The amount of work does not grow with the number of requests canceled.
A thread whose lock request is canceled rechecks the synchronization condition. If it still needs to wait, it retries by acquiring the existing lock directly. That keeps repeated wake-all requests from canceling the same wait registration indefinitely.
The gate has two variants, Ticket and Queue. Ticket waiters monitor a shared ticket counter. On many-core systems, updates invalidate the waiters' cached copies. Queue uses a separate waiting location for each thread, reducing that cost at the expense of memory.
Woken threads wake other threads
Linux keeps futex waiters in a hash table. A key determines which bucket a waiter goes into, but a bucket can hold waiters for different futexes. There are also conditions for deciding which waiters to wake, so the existing implementation checks them individually.
The prototype records during wait registration whether all waiters have the same futex key and the same bitset used to filter wakeups. When those fields match and all waiters are eligible, their list can be detached in one operation along with an array. If the number of waiters exceeds the number of hardware threads, the code falls back to the existing path.
The implementation also delegates wakeups to some threads as they become runnable. Starting with the first thread, the number of threads doing the work increases, and they split the remaining wakeups among themselves.
For n waiters, the theoretical critical path, the longest chain of operations that must still run in sequence, changes from linear time, O(n), to logarithmic time, O(log n).
The same number of threads must become runnable. More threads take part in waking them. The idea is to parallelize a mechanism that parallel computation already relies on.
Why a faster lock can slow down a barrier
The researchers also tried speeding up the lock itself. In repeated barrier tests on x86 servers, replacing the wait list lock with a faster lock called TCLock made synchronization take longer when all hardware threads were in use.
Faster acquisition let more threads join the wait list before the synchronization value changed. More threads actually went to sleep. With sequential wakeups, that meant more work afterward.
On the NAS Parallel Benchmarks, removing parallel wakeups eliminated nearly all the performance gains in workloads with frequent barriers. Traces showed that bringing threads together more quickly with parallel wakeups increased lock contention at the next barrier. Combining parallel wakeups with the Abort Gate reduced that cost as well.
The benefit came from looking at the full path from waiting to waking, beyond how fast one lock runs. Accounting for what happens before and after the lock is what makes the design interesting.
How much faster the workloads ran
The researchers pinned one software thread to each hardware thread and used the median of repeated measurements. In a barrier microbenchmark that gave waiting threads time to sleep, the prototype delivered up to an 8.7x speedup over the existing implementation when all hardware threads were used.
For NAS workloads with frequent synchronization, the paper reports geometric mean speedups of 1.3x to 1.9x, depending on input size, and a maximum of 4.4x.
A test of 45 barrier-heavy workloads from Rodinia, the GAP Benchmark Suite, oneDNN, and high-performance computing proxy applications yielded a 2.1x geometric mean speedup over conventional sleeping waits. The largest gain was 6.2x on TeaLeaf running on a server with an AMD EPYC 9555.
In NAS, the gains shrank as input size increased because more computation happened between barriers. Kripke also saw smaller improvements because it spends longer computing between synchronization points.
Prototype performance vs. sleeping waits in Linux 6.19
| Test | Conditions | Geometric mean | Maximum |
|---|---|---|---|
| Synchronization time | All CPU threadsin use All waiters sleeping | — | 8.7x |
| NASParallel computation | Frequent synchronization | 1.3–1.9x | 4.4x |
| Computational workloads45 workloads | High synchronization overhead | 2.1x | 6.2x |
※A dash indicates no data.
The gains are likely to be larger when synchronization accounts for more of the workload. If the CPU spends most of its time doing useful computation between barriers, shortening synchronization changes less of the total runtime.
The benefit and cost of freeing the CPU while waiting
Spin waiting keeps a thread active on a CPU, repeatedly checking whether the synchronization condition has been met. It can react immediately when the condition changes and continues occupying the CPU in the meantime.
In comparisons on barrier-heavy workloads with no extra competing load, the prototype's sleeping wait reached 78% of the performance of conventional spin waiting. It speeds up synchronization while letting sleeping threads release the CPU.
A different problem arises when there are more runnable threads than hardware threads and they compete for CPU time. If a thread with delegated wakeups has to wait to run, the wakeups it was assigned also wait. With the conventional sleeping implementation, the thread that handles wakeups is already running. In tests with extra load, it could be faster than the prototype.
Parallel wakeups need CPU time on the threads that help perform them. The best waiting strategy depends on how much CPU capacity is available.
Performance beyond the application
The prototype preserves the existing futex interface and semantics. It improves the private hash table within a process. The table for futexes shared across processes is unchanged. The existing code also handles partial wakeups and operations that use priority inheritance.
The design enables the gate only where wake-all requests occur and when needed. The researchers conclude that it avoids a slowdown in workloads without wake-all operations.
If the design reaches production, applications that use the affected synchronization paths could benefit from the kernel changes without changing their own code.
The researchers also point to further opportunities for choosing which threads take on wakeup work, including NUMA systems where memory access time depends on CPU location and systems with cores of different speeds.
Adding cores can make computation faster without making coordination itself any faster. The study shows how extra computing capacity can also help with synchronization.
