Chained resource locking
AssigneeMicron Technology, Inc.
InventorsPatrick Estep, Tony M. Brewer
Life of this patent
Estimating the term…
Abstract
Devices and techniques for CHAINED RESOURCE LOCKING are described herein. Threads form a last-in-first-out (LIFO) queue on a resource lock to create a chained lock on the resource. A data store representing the lock for the resource holds the previous thread's identifier, enabling a subsequent thread to wake the previous thread using the identifier when the subsequent thread releases the lock. Generally, the thread releasing the lock need not interact with the data store, reducing contention for the data store among many threads.
Claims29
A system comprising:
- a memory controller configured to maintain a datastore representing a lock of a resource;
- and
- a hybrid threading processor (HTP) configured to execute a first thread to:
- obtain a lock value from the datastore;
- responsive to the lock value corresponding to a thread identifier of a second thread and indicating that the resource is locked:
- store the thread identifier of the second thread obtained from the lock value in the first thread;
- write a second thread identifier corresponding to the first thread into the lock value in the datastore to replace the thread identifier for the second thread in the lock value;
- and
- sleep the first thread, the thread identifier being a unique destination value for the second thread, threads of the HTP each having a different thread identifier from each other;
- continue execution using the resource based on a first wake message corresponding to the resource, wherein the first wake message originated from a third thread and granted the first thread the lock without interacting with the lock value in the datastore;
- and
- release the lock by sending a second wake message to the second thread based on the thread identifier stored in the first thread to awake the second thread to use the resource, the first thread being a link in a last-in-first-out (LIFO) chain that includes the second thread and the third thread, and wherein any thread that writes a thread identifier to the lock value does not have the lock when the thread identifier is written to the lock value.
An apparatus comprising:
- a network interface;
- and
- processing circuitry, in a hybrid thread processor (HTP), configured to execute a first thread to:
- obtain, using the network interface, a lock value from a datastore representing a lock of a resource;
- responsive to the lock value corresponding to a thread identifier of a second thread and indicating that the resource is locked:
- store the thread identifier of the second thread obtained from the lock value in the first thread;
- write a second thread identifier corresponding to the first thread into the lock value in the datastore to replace the thread identifier for the second thread in the lock value;
- and
- sleep the first thread, the thread identifier being a unique destination value for the second thread, threads of the HTP each having a different thread identifier from each other;
- continue execution using the resource based on a first wake message corresponding to the resource, wherein the first wake message originated from a third thread and granted the first thread the lock without interacting with the lock value in the datastore;
- and
- release the lock by sending a second wake message, through the network interface, to the second thread based on the thread identifier stored in the first thread to awake the second thread to use the resource, the first thread being a link in a last-in-first-out (LIFO) chain that includes the second thread and the third thread, and wherein any thread that writes a thread identifier to the lock value does not have the lock when the thread identifier is written to the lock value.
Non-transitory machine readable media including instructions that, when executed by processing circuitry, cause the processing circuitry to perform operations comprising:
- obtaining, by a first thread executing in processing circuitry, a lock value from a datastore representing a lock of a resource;
- responsive to the lock value corresponding to a thread identifier of a second thread and indicating that the resource is locked:
- storing the thread identifier of the second thread obtained from the lock value in the first thread;
- writing a second thread identifier corresponding to the first thread into the lock value in the datastore to replace the thread identifier for the second thread in the lock value;
- and
- sleeping the first thread, the thread identifier being a unique destination value for the second thread, threads of the processing circuitry each having a different thread identifier from each other;
- continuing execution of the first thread using the resource based on a first wake message corresponding to the resource, wherein the first wake message originated from a third thread and granted the first thread the lock without interacting with the lock value in the datastore;
- and
- releasing the lock by sending a second wake message, from the first thread, to the second thread based on the thread identifier stored in the first thread to awake the second thread to use the resource, the first thread being a link in a last-in-first-out (LIFO) chain that includes the second thread and the third thread, and wherein any thread that writes a thread identifier to the lock value does not have the lock when the thread identifier is written to the lock value.
Dependencies are inferred from the claim text.