Please enable JavaScript.
Coggle requires JavaScript to display documents.
Process Synchronization (Segments of a Process (Critical Section Problem…
Process Synchronization
Segments of a Process
Segment of Code
Called critical section. Segment where process may be changing variables, updating tables or writing on files.
-
-
-
Critical Section Problem
Is to design a protocol that the processes can use to cooperate and not entering critical sections at the same time.
-
Progress
If no process is executing its critical section and processes wish to enter its CS only those processes not executing remainder sections can participate to decide which process will enter CS first.
Bounded Waiting
There is a limit on number of times a process can access CS after they have made a request to enter CS.
Mutex Locks
-
A process must acquire the lock before entering a critical section and then releases the lock when it exits the critical section.
Busy Waiting
Main disadvantage of this method. If a process acquires a lock all other process waiting for the lock must loop continuously on acquire call until the lock is released. This loop is also called spinlock.
-
When locks are expected to be used for short times spinlocks are useful since they need no context switch.
Semaphores
More robust tool than mutex locks. They offer more sophisticated ways to synchronize process activities.
It is an integer variable. It is accessed only through standard atomic operations wait() and signal().
Counting semaphore
-
The semaphore is initialized to the instances available of the resource. Each time a process wishes to use the resource it performs wait() decrementing the count and when it is release it performs a signal() incrementing the count.
Binary Semaphore
Can range only between 0 and 1. Behave similarly to mutex locks. On systems that do not provide mutex locks this semaphores can be used.
-
Transactional Memory
-
-
On a system with this memory you can perform a group of operations as atomic with atomic[S] being s the group of operations.
-