发明名称 |
System and Method for Implementing Scalable Adaptive Reader-Writer Locks |
摘要 |
NUMA-aware reader-writer locks may leverage lock cohorting techniques and may support reader re-entrancy. They may implement a delayed sleep mechanism by which a thread that fails to acquire a lock spins briefly, hoping the lock will be released soon, before blocking on the lock (sleeping). The maximum spin time may be based on the time needed to put a thread to sleep and wake it up. If a lock holder is not executing on a processor, an acquiring thread may go to sleep without first spinning. Threads put in a sleep state may be placed on a turnstile sleep queue associated with the lock. When a writer thread that holds the lock exits a critical section protected by the lock, it may wake all sleeping reader threads and one sleeping writer thread. Reader threads may increment and decrement node-local reader counters upon arrival and departure, respectively. |
申请公布号 |
US2015286586(A1) |
申请公布日期 |
2015.10.08 |
申请号 |
US201414246975 |
申请日期 |
2014.04.07 |
申请人 |
Oracle International Corporation |
发明人 |
Yadav Rahul |
分类号 |
G06F12/14;G06F9/52 |
主分类号 |
G06F12/14 |
代理机构 |
|
代理人 |
|
主权项 |
1. A method, comprising:
performing by a computer:
beginning execution of a multithreaded application that comprises one or more requests to acquire a reader-writer lock, wherein the reader-writer lock controls write access to a critical section of code by concurrently executing threads of the application and further controls access to the critical section of code in read-only mode, wherein the reader-writer lock allows at most one writer thread to hold the reader-writer lock for writing at a time, and wherein the reader-writer lock allows multiple reader threads to hold the reader-writer lock in read-only mode at the time same;a given thread of the application requesting acquisition of the reader-writer lock;determining that another thread has acquired the reader-writer lock or has indicated an intent to acquire the reader-writer lock;determining one of a plurality of available actions to be taken in response to said requesting; andtaking the determined action;wherein determining the action is dependent on one or more of: whether the given thread is a reader thread or a writer thread, whether the other thread is a reader thread or a writer thread, or whether the other thread is currently executing the critical section of code on a processor core; andwherein the plurality of available actions comprises the given thread beginning a spin-type operation; putting the given thread in a sleep state, wherein in the sleep state the given thread does not consume processor resources; and the given thread acquiring the reader-writer lock without first performing a spin-type operation and without first being put in sleep state. |
地址 |
Redwood City CA US |