In this video, we have discussed in detail what is process synchronization from Operating systems in detail.
Types of processes in Operating Systems
There are two types of processes in an Operating System:
- Independent processes: The execution of independent processes is not affected by each other.
- Cooperating processes: A cooperating process can affect or be affected by the execution of other cooperating processes.
Since cooperating processes share common resources with each other, the problem of process synchronization exists in the case of cooperating processes. Race condition arises in the case of cooperating processes. When cooperating processes access shared code or shared variables, then the order in which these processes utilize the shared resources affects the final value of these resources.
Race conditions occur inside a critical section that contains code to manipulate shared resources among cooperating processes. A critical section is a code segment that can be accessed by only one process at a time. Race conditions can be avoided in a critical section when the entire critical section code is executed as a single atomic operation. To avoid race conditions, thread execution must be synchronized inside the critical section. This can be achieved using atomic variables and locks inside the critical section, to ensure that shared resources are accessed in a proper manner by the cooperating processes. So process synchronization means developing a way for cooperating processes to access shared resources in a consistent manner.
Any process synchronization solution to the critical section problem must satisfy the following conditions:
- Mutual Exclusion
- Progress
- Bounded Waiting
Process Synchronisation in OS:
https://www.geeksforgeeks.org/introduction-of-process-synchronization/