Blocking Local Sense Synchronization Barrier for Parallel Threads
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
Existing synchronization barriers in parallel computing are inefficient and lack robust support for real-world usage, particularly in handling thread synchronization and safe deletion, leading to duplicated work and potential code inaccuracies.
Innovation Solution
A blocking local sense synchronization barrier is implemented using a variable to determine when threads should be released, ensuring safe deletion by maintaining a count of variables that have left the barrier, and utilizing notification events to optimize thread blocking and spinning operations.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If a synchronization barrier is implemented to ensure all threads finish one phase before beginning the next, then thread synchronization reliability is improved, but system overhead and complexity increase
Solution Approach 1:
The barrier mechanism is segmented into distinct components: a barrier object that manages synchronization state, individual thread functions that call the barrier, and internal state variables (count, sense flag) that track progress. This segmentation allows each component to have a specific, simple responsibility while collectively providing robust synchronization.
Solution Approach 2:
The barrier object acts as an intermediary between threads that need to synchronize. Instead of threads directly communicating or checking each other's state, they all interact with the barrier object which mediates the synchronization by tracking arrivals and coordinating the release of all threads simultaneously.
2Productivity
If existing barrier implementations are used, then basic synchronization functionality is provided, but performance is slow and deletion support is inadequate
Solution Approach 1:
The barrier mechanism uses self-service techniques where threads independently update the barrier's internal state (incrementing count, checking sense flag) without requiring external coordination. The barrier object autonomously manages its own state transitions and determines when all threads have arrived, eliminating the need for additional synchronization primitives that would slow down the process.
Solution Approach 2:
The implementation uses parameter changes in the form of state variables (count variable that increments with each thread arrival, sense flag that toggles between true/false) to track synchronization progress. These simple parameter changes provide fast, efficient state tracking without complex data structures or operations.
3Measurement precision
If threads spin waiting for the last thread to arrive at the barrier, then synchronization precision is improved, but CPU energy consumption increases
Solution Approach 1:
Instead of continuous spinning, threads perform periodic checks of the barrier state. The sense flag mechanism allows threads to efficiently determine whether they should spin or proceed, creating a periodic rather than continuous energy-consuming operation. The last thread to arrive toggles the sense flag, which periodically wakes other threads to check the state.
Data Source
AI summary
A blocking local sense synchronization barrier is provided. The local sense variable is not processor private or global, but truly local to the synchronization barrier function. Safe deletion is provided by making sure the last operation a thread performs on a barrier is a write. Just before returning, threads increment a field that indicates the count of threads that have left the barrier. Blocking is supported such that threads spin for some interval, and when they decide to block, examine and set (if not already set) the indication of whether a thread is blocking that is to be examined by the last thread to arrive at the barrier to determine whether to set an event to release blocking threads.


