sun solaris 2 - os synchronization

9

Upload: vsunny488

Post on 11-Apr-2015

468 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: SUN Solaris 2    - OS SYNCHRONIZATION
Page 2: SUN Solaris 2    - OS SYNCHRONIZATION

Adaptive mutexReader-writer locksTurnstilesConditional variablesSemaphores

Page 3: SUN Solaris 2    - OS SYNCHRONIZATION

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

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

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

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

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

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