Performance evaluation of synchronization algorithms in lightweight thread environments in C++
Abstract
Traditionally, multithreaded data structures have been designed and tested for use with Operating System (OS) threads. However, in recent years, programming languages have introduced an alternative — lightweight threads (also known as asynchronous calls or coroutines). These threads can be divided into two types: stackful and stackless; this paper focuses on stackful coroutines. The main advantage of lightweight threads lies in their reduced overhead. Unlike OS threads, the C++ Standard Library lacks a native implementation of stackful lightweight threads. They are instead provided by several third-party libraries which differ in scheduling policies, memory management approaches, and interfaces. Moreover, reusing existing code is often infeasible due to the explicit marking of context-switching points required by coroutines, their absence may lead to deadlocks between lightweight threads. To narrow the research scope, this work focuses on a specific synchronization primitive — the mutex (mutual exclusion). Several lightweight threading libraries were examined, including Argobots, Boost Fibers, and Userver. Based on an analysis of their functionality, a three-phase waiting mechanism was developed that combines active spinning, context switching, and coroutine suspension and resumption techniques. The description of the mechanism includes a general approach for integrating it into existing mutex algorithms. This mechanism acts as an additional abstraction layer between lightweight threading libraries and mutex implementations, enabling a unified design. Due to the absence of existing solutions, a dedicated tool was developed for testing and performance evaluation of the modified mutexes. Using the proposed method, several well-known mutexes were adapted for the usage from lightweight threads. To test these primitives, a tool was created that allows integration with arbitrary coroutine implementations and accounts for their specific execution models. The throughput of the adapted mutexes was measured using this tool under a specialized workload scenario, reflecting the characteristics of cooperative multitasking. In future work, the aim is to develop a comprehensive library encompassing all known mutex implementations adapted for lightweight thread environments. This will enable detailed performance comparisons across coroutine libraries, scheduling algorithms, and processor architectures. It is expected that a thorough analysis of existing algorithms behavior will lead to the development of a new mutex design optimized for lightweight thread execution.
Fields of Study & Subjects
Distributed systems and fault tolerance
Parallel Computing and Optimization Techniques
Logic
programming
and type systems
Publication details
- Journal / source
- Scientific and technical journal of information technologies mechanics and optics
- Volume
- 26
- Issue
- 1
- Pages
- 125–134
- Publication date
- 25 February 2026
- Language
- EN