You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Read-Write-Spinlock implements the idea of latch-and-spin mechanism normally used for non-blocking concurrency.
Blocking concurrency can have impact on latency. When operations that require rw-exclusion is going to be quick and short, we can use non-blocking primitives like latch-and-spin.
What is Latch and spin ?
In typical multi-core processors, concurrent read operations are always safe and consistent. But it becomes unsafe, when there is a writer concurrently modifying data while readers are loading it from memory.
Latch-and-lock mechanism can be used when we want to allow one or more concurrent writer(s) along with readers.
Imagine a door leading into a room. This door has some special properties:
The door has a latch and a lock.
A reader can enter the room only when the door is un-locked and un-latched.
A writer can enter the room only when the door is un-locked and, un-latched and, there are no other reader or writer in the room.
Once the door is latched by a writer, no other writer or reader can enter the room because of (1) and (2) properties. But all readers who are already inside the room can finish their job and then exit.
A writer can enter the room only after locking the door, which the writer can do only after all the readers have exited.
When trying to acquire read-permission or write-permission, the caller thread shall spin until all the conditions from (1) to (5) are met. Once a thread acquires necessary permission it can continue to finish its job and then release the permission.
The text was updated successfully, but these errors were encountered:
prataprc
changed the title
LatchAndSpin mechanism.
Latch-And-Spin mechanism.
Aug 29, 2019
Read-Write-Spinlock implements the idea of latch-and-spin mechanism normally used for non-blocking concurrency.
Blocking concurrency can have impact on latency. When operations that require rw-exclusion is going to be quick and short, we can use non-blocking primitives like latch-and-spin.
What is Latch and spin ?
In typical multi-core processors, concurrent read operations are always safe and consistent. But it becomes unsafe, when there is a writer concurrently modifying data while readers are loading it from memory.
Latch-and-lock mechanism can be used when we want to allow one or more concurrent writer(s) along with readers.
Imagine a door leading into a room. This door has some special properties:
The text was updated successfully, but these errors were encountered: