sun solaris 2 - os synchronization
TRANSCRIPT
![Page 1: SUN Solaris 2 - OS SYNCHRONIZATION](https://reader035.vdocuments.net/reader035/viewer/2022062418/552949a2550346b52e8b46ee/html5/thumbnails/1.jpg)
![Page 2: SUN Solaris 2 - OS SYNCHRONIZATION](https://reader035.vdocuments.net/reader035/viewer/2022062418/552949a2550346b52e8b46ee/html5/thumbnails/2.jpg)
Adaptive mutexReader-writer locksTurnstilesConditional variablesSemaphores
![Page 3: SUN Solaris 2 - OS SYNCHRONIZATION](https://reader035.vdocuments.net/reader035/viewer/2022062418/552949a2550346b52e8b46ee/html5/thumbnails/3.jpg)
Protects access to every critical data items .
Adaptive mutex starts as a standard semaphore implementation in a spinlock on a multiprocessor system .
![Page 4: SUN Solaris 2 - OS SYNCHRONIZATION](https://reader035.vdocuments.net/reader035/viewer/2022062418/552949a2550346b52e8b46ee/html5/thumbnails/4.jpg)
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
![Page 5: SUN Solaris 2 - OS SYNCHRONIZATION](https://reader035.vdocuments.net/reader035/viewer/2022062418/552949a2550346b52e8b46ee/html5/thumbnails/5.jpg)
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.
![Page 6: SUN Solaris 2 - OS SYNCHRONIZATION](https://reader035.vdocuments.net/reader035/viewer/2022062418/552949a2550346b52e8b46ee/html5/thumbnails/6.jpg)
Adaptive mutex is used for smaller code segments .
For longer code segments conditional variables and semaphores are used .
![Page 7: SUN Solaris 2 - OS SYNCHRONIZATION](https://reader035.vdocuments.net/reader035/viewer/2022062418/552949a2550346b52e8b46ee/html5/thumbnails/7.jpg)
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
![Page 8: SUN Solaris 2 - OS SYNCHRONIZATION](https://reader035.vdocuments.net/reader035/viewer/2022062418/552949a2550346b52e8b46ee/html5/thumbnails/8.jpg)
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
![Page 9: SUN Solaris 2 - OS SYNCHRONIZATION](https://reader035.vdocuments.net/reader035/viewer/2022062418/552949a2550346b52e8b46ee/html5/thumbnails/9.jpg)