Professional Documents
Culture Documents
Case Study3 VthSem
Case Study3 VthSem
6.2
2
SYNCHRONIZATION OF POSIX
THREADS
POSIX threads provide:
• Mutexes for mutual exclusion
• A mutex is a binary semaphore
• Condition variables for control synchronization between
processes
6.3
3
PROCESS SYNCHRONIZATION
IN UNIX
Unix system V provides a kernel-level implementation of
semaphores
• Name of a semaphore is called a key
• Key
K isi associated
i t d with
ith an array off semaphores
h
• Processes share a semaphore by using the same key
6.4
4
PROCESS SYNCHRONIZATION
IN LINUX
Linux has Unix-like
Unix like semaphore for user processes
Also provides semaphores for use by the kernel:
• Conventional semaphore
p
• Uses efficient kernel-level implementation scheme
• Reader–writer semaphore
6.5
5
PROCESS SYNCHRONIZATION
IN SOLARIS
Interesting features:
• Reader–writer semaphores
• Analogous to the one in Linux
• Adaptive mutexes
• Useful in a multiprocessor OS
• Uses the p
priority
y inheritance p
protocol to reduce synchronization
y
delays
• Data structure called a turnstile
• Holds information concerning
g threads that are blocked on a mutex
or reader–writer semaphore
• Used for synchronization and priority inheritance
6.6
6
PROCESS SYNCHRONIZATION
IN WINDOWS
Dispatcher object is embedded in every object over which
synchronization is needed
• It can be in signaled/non-signaled state
• Dispatcher objects used in process, file, etc. (next slide)
p , queued
Provides spinlock, q spinlock,
p , fast mutex and push
p locks
6.7
7
PROCESS SYNCHRONIZATION IN
WINDOWS
6.8
8
SUMMARY
Process synchronization is a generic term for data access synchronization
and control synchronization
A id
Avoidance off race conditions
diti is
i a primary
i issue
i in
i process synchronization
h i ti
6.9
9