CPU/GPU Mutex Synchronization via Shadow Threads
Find Innovative SolutionsGenerate Solutions
Solution Overview
Problem
In multithreaded applications, the existing mechanisms for synchronizing access to shared data between a central processing unit (CPU) and a graphics processing unit (GPU) are inefficient due to reliance on mutex locks, which can lead to power and performance issues, especially when threads on different cores need to access shared resources.
Innovation Solution
A processing apparatus is introduced that creates an auxiliary shadow thread on the CPU to manage mutex locking and unlocking for threads on the GPU, allowing the operating system to handle thread synchronization, enabling efficient communication and synchronization between CPU and GPU threads through system calls and shadow threads.
Engineering Contradictions & Design Principles
Engineering Contradiction Analysis
1Reliability
If mutex locking is implemented through spinning on lock, then thread synchronization between CPU and GPU is achieved, but power consumption increases and performance deteriorates
Solution Approach 1:
The patent introduces an intermediary mechanism where the CPU writes mutex state to GPU-visible memory locations and the GPU polls these locations to determine mutex availability. This intermediary approach replaces direct spinning locks with a mediator-based synchronization protocol, reducing unnecessary busy-waiting and improving power efficiency while maintaining synchronization reliability.
Solution Approach 2:
The patent implements dynamic synchronization behavior where threads can choose between polling and sleeping modes based on mutex availability. When a mutex is available, threads proceed immediately; when unavailable, threads can sleep and be notified when the mutex becomes available. This dynamic approach adapts to system conditions and avoids continuous power-consuming polling.
2Reliability
If mutex locking is implemented through spinning on lock, then thread synchronization between CPU and GPU is achieved, but processing speed decreases
Solution Approach 1:
The patent implements preliminary action by having the CPU write the mutex state to GPU-visible memory locations before the GPU needs to access it. This advance preparation allows the GPU to quickly check mutex availability without prolonged waiting, improving processing speed while maintaining synchronization reliability.
Solution Approach 2:
The patent implements a feedback mechanism where the GPU polls CPU-written mutex state and receives implicit feedback about mutex availability. When the mutex state changes, the system can notify waiting GPU threads, providing timely feedback that accelerates synchronization and improves overall processing speed.
3Reliability
If system calls are used for mutex synchronization, then thread coordination between CPU and GPU is improved, but system complexity increases
Solution Approach 1:
The patent implements a universal synchronization mechanism that handles both CPU-CPU and CPU-GPU mutex coordination through the same shadow thread infrastructure. The shadow thread system provides multi-functional capability, managing mutex locks for different processor types uniformly, which improves coordination reliability while managing system complexity through consolidation rather than multiplication of mechanisms.
4Productivity
If shadow threads are introduced for mutex management, then mutex operation efficiency is improved, but implementation complexity increases
Solution Approach 1:
The patent implements self-service through shadow threads that autonomously manage mutex locking and unlocking operations. The shadow threads independently monitor mutex state, write to GPU-visible memory, and notify waiting threads without requiring direct CPU-GPU coordination for each mutex operation. This self-service approach improves mutex operation efficiency while containing implementation complexity by delegating management to specialized autonomous threads.
Data Source
Figure 1
Figure 2
Figure 3
AI summary
A thread on one processor may be used to enable another processor to lock or release a mutex. For example, a central processing unit thread may be used by a graphics processing unit to secure a mutex for a shared memory.