Adaptive mutexReader-writer locksTurnstilesConditional variablesSemaphores
Protects access to every critical data items .
Adaptive mutex starts as a standard semaphore implementation in a spinlock on a multiprocessor system .
If the data is already locked .. If the lock is held by a thread that is
running on another CPU, the thread spins while waiting for the release .
If the thread holding the lock is not in the run state ,the thread block sleeps until it is awakened .
Multiprocessor system
Uniprocessor system
The thread holding the lock is never running if the lock is being tested by another thread .
Ie a thread always sleep rather than spin if it encounter a lock.
Adaptive mutex is used for smaller code segments .
For longer code segments conditional variables and semaphores are used .
Used to protected data that are accessed frequently .
Usually in a read – only manner. Better than semaphores
multiple threads can read data concurrently. Semaphores only allows serialize access to the
data.
Read-Writers are more expensive to implement
Use only for long term scheduling
Used to Order the list of threads waiting to acquire either an adaptive mutex or read-write lock.
Turnstiles has a queue structure containing threads blocked on a lock.
Organized according to priority inversion protocol. i.e. if a lower priority thread currently holds
a lock that a higher –priority thread is blocked on, the thread with lower priority will temporary inherits the priority of the higher –priority thread