Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>It allows multiple threads to read a resource concurrently, but requires a thread to wait for an exclusive lock in order to write to the resource.</p> <p>Rules are:</p> <ul> <li>Several readers can share the resource concurrently. If you have a read lock, you can safely acquire another read lock. The maximum count of shared locks is 1111 1111 1111 1111</li> <li>If you have a read lock, you CANNOT acquire a write lock</li> <li>If you have a write lock, you CANNOT acquire a read lock in any other thread.</li> <li>A reader can access the resource when there are no writers active in any other thread.</li> <li>If you have a write lock, you can acquire another write lock in the same thread. The maximum count of exclusive locks that a thread can own is 1111 1111 1111 1111</li> <li>A writer can access the resource when no other reader or writer (from a different thread) is active.</li> <li>Prefers writers over readers. That is, if a writer is waiting on the lock, no new readers from other thread are allowed to access the resource. Existing readers can continue to use the resource until they release the lock. This prevents so-called "writer starvation". </li> <li>Allows downgrading from the write lock to a read lock, by acquiring the write lock, then the read lock and then releasing the write lock. However, upgrading from a read lock to the write lock is not possible.</li> </ul> <p>Internally the lock state (c) is maintained by an int value. In this case, since we have read and write locks, it is logically divided into two shorts: The lower one representing the exclusive (writer) lock hold count, and the upper the shared (reader) hold count.</p> <p>Assuming current state of lock is c= xxxx xxxx xxxx xxxx yyyy yyyy yyyy yyyy then Number of reader locks are the upper bits xxxx xxxx xxxx xxxx </p> <p>Number of writer locks are the lower bits yyyy yyyy yyyy yyyy</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload