Process Synchronization


From here, onwards we have entered a whole new unit of operating system tutorials in which we will learn about Process Synchronization. So, let's start, shall we?
Process Synchronization means sharing system resources among processes in a very efficient way. We have basically 2 types of processes, on the basis of synchronization:

  1. Independent Processes: These are the processes which operates independently without affecting other processes.
  2. Cooperative Processes : These are the processes which can affect execution of some other process.
The main challenge in Process Synchronization is to synchronize cooperative processes because they share resources.

Race Condition

It is a condition in which several processes try to access shared memory, variable or program then there is a chance that the output of that shared memory, variable, program is wrong and for that all processes doing race that my output is correct is known as race condition.

Critical Section Problem

Critical section of a code is that part of the code where a process access shareable resources. To order to enter inside critical section a process has to pass through an entry section first which is handled by wait(). When a process wants to exit critical section then it passes through exit section which is handled by signal(). Sice only one process executes inside critical section thus other processes have to wait until the current process finishes its execution in critical section.
In critical section problem is a set of rules which ensures at a time only one process access critical section and race condition never arises among process.

Process Synchronization


In order to solve critical section problem we have several solutions which I will discuss in upcoming posts.
But now we have to understand the three conditions which ensures that the critical section problem is solved.

Conditions for solution of Critical Section Problem

Mutual Exclusion : It means that at a time only one process shall be entering a critical section. Mutual Exclusion is a mandatory criteria which means that it should be satisfied no matter what.

Progress : It means that only those processes should be taken into account which really wish to enter critical section. It is also a mandatory criteria.

Bounded Waiting : It might happen that a process is waiting to enter critical section for a long time which leads to starvation. So, to avoid starvation of a process there must be a bounded time limit after which we can guarantee that a process will enter critical section. It is an optional criteria and we will see that when we will learn about semaphores.


Post a Comment (0)
Previous Post Next Post