Please enable JavaScript.
Coggle requires JavaScript to display documents.
CHAPTER 6 : SYNCHRONIZATION, NURUL IZZAH BINTI KAMARUL ZAMAN 2020980775 -…
CHAPTER 6 : SYNCHRONIZATION
Evaluation
The various tools that can be used to solve the critical-section problem as well as to synchronize the activity of processes can be evaluated under varying levels of contention. Some tools work better under certain contention loads than others.
Monitors
a high-level abstraction that provides a convenient and effective mechanism for process synchronization
only one process may be active within the monitor at a time
A monitor type is an ADT that includes a set of programmer-defined operations that are provided with mutual exclusion within the monitor
Two possible exist : Signal and wait , signal and continue
Critical Section Problem
requirements
Mutual exclusion
The progress
The bounded-waiting
Each process must ask permission to enter critical section in entry section, may follow critical section with exit section, then remainder section
Two general approaches are used to handle critical sections in operating systems: preemptive kernels and nonpreemptive kernels.
Hardware Support for Synchronization
Many systems provide hardware support for critical section code
Uniprocessors - could disable interrupts
atomic = non-interruptable
either test memory word and set value or swap contents of two memory words
Semaphores
Semaphores S - integer variable
Two standard operations modify S
wait()
signal()
Less complicated
Can only be accessed via two indivisible (atomic) operations
Semaphore Usage
Counting semaphore - integer value can range over an unrestricted domain
Binary semaphore - integer value can range only between 0 and 1; can be simpler to implement
Can implement a counting semaphore S as a binary semaphore
Provides mutual exclusion
Peterson's Solution
two process solution
Assume that the LOAD and STORE instructions are atomic, that is, cannot be interrupted
requires two process share two variable
Liveness
Liveness refers to a set of properties that a system must satisfy to ensure that processes make progress during their execution life cycle
Deadlock
The event in question is the execution of a signal() operation. When such a state is reached, these processes are said to be deadlocked
Priority Inversion
occur only in systems with more than two priorities
Mutex Locks
Values of the lock are either 0 or 1
Can be used between threads in the same process.. only
The type of mutex lock we have been describing is also called a spinlock because the process “spins” while waiting for the lock to become available.
Background
Processes can execute concurrently
Maintaining data consistency requires mechanisms to ensure the orderly execution of cooperating processes
Race condition on kernel variable next_available_pid which represents the next available process identifier (pid)
NURUL IZZAH BINTI KAMARUL ZAMAN
2020980775