Sometimes components are conservatively implemented as thread-safe, while during the actual execution they are only accessed from one thread. In these scenarios, overly conservative assumptions lead to suboptimal performance.
The contribution of this paper is a component architecture that combines the benefits of different synchronization mechanisms to implement thread-safe concurrent components. Based on the thread contention monitored at runtime, context-aware composition and optimization select the appropriate mechanism. On changing contention, it revises this decision automatically and transforms the components accordingly. We implemented this architecture for concurrent queues, sets, and ordered sets. In all three cases, experimental evaluation shows close to optimal performance regardless of the actual contention.
As a consequence, programmers can focus on the semantics of their systems and, e.g., conservatively use thread-safe components to assure consistency of their data, while deferring implementation and optimization decisions to contention-context-aware composition at runtime.