Spin/Sleep Proactive-Awakening Locks for Alternative Performance/Energy Trade-Offs
Published in Concurrency and Computation: Practice and Experience, 2025
Abstract
Locking plays a crucial role since it ensures synchronized access by concurrent threads to shared resources—like shared data structures to be managed in critical sections. Traditional sleep locks—based on blocking operating system services—adopt a reactive approach (e.g., upon lock release) to waking up waiting threads, which might introduce additional latency on the critical path. On the opposite side, non-blocking locks, like spinlocks, allow threads to wait while still using CPU cycles for checking and updating the lock variable, which causes the waste of both cycles and energy. In this article, we present a new locking algorithm, called SSPA (Spin/Sleep Proactive-Awakening)—and its implementation for Linux systems—which combines spin and sleep waiting phases via the introduction of an innovative proactive wake-up mechanism that exploits the SoftIRQ daemon of the Linux kernel. Our solution allows threads to be awakened from their sleep phases on time to be already CPU dispatched when the lock is really released. This provides the opportunity to quickly access the critical section while at the same time enabling control over the actual amount of CPU cycles that are spent by spinning wait phases. As we show via experimental data, our solution allows exploring new trade-offs between responsiveness and CPU/energy efficiency in concurrent applications, hence rising as an interesting alternative to literature solutions.
Recommended citation: M.Federico, R.Marotta, and F.Quaglia, “Spin/Sleep Proactive-Awakening Locks for Alternative Performance/Energy Trade-Offs,” Concurrency and Computation: Practice and Experience37, no. 27-28 (2025): e70433, https://doi.org/10.1002/cpe.70433.
Link Paper
