摘要 |
<p>Systems and methods are described for resource locking and thread synchronization in a multiprocessor environment. When a requesting CPU (205) is executing a thread that needs access to a protected resource in the shared resource unit (210), it sends a request to a acquire a spinlock to the shared resource control logic (201). Upon receiving the request, the shared resource control logic (201) decides whether the spinlock is free for the requesting CPU (205) to use by reading a lock register (203). If the spinlock is free, the shared resource control logic (201) instructs the requesting CPU (205) to acquire the spinlock by writing a proxy value into the lock register (203). If the spinlock is in use, the lock register (203) contains the proxy value written to it by the CPU using spinlock. The requesting CPU (205) then sends its proxy value to the shared resource control logic (201) which enqueues the proxy into a FIFO which contains proxies for all of the CPUs requesting the spinlock. The spinlock is passed to the requesting CPUs based on their enqueued proxies. Once all of the requests for the spinlock have been satisfied the shared resource control logic (201) instructs the last requesting CPU to write a zero to the lock register (203) to indicate it is free for subsequent use.</p> |