CREATE OWN LIBRARY

Inter-process communication and Synchronization

 

Introduction to Process Synchronization

The process is characterized into two types 

 

i)  Co-operative processes

ii) Independent/Isolated processes

 

Two or more processes are said to be co-operative, if they get affected or affects the execution of other processes i.e. the execution of two or more processes are dependent on each other otherwise they said to be independent.

Cooperative processes can either directly share a logical address space (both code, data) or be allowed to share data only through files or messages. They can also be shared common resources, memory space, etc. 

 

 

An important and fundamental feature in modern OS is the concurrent execution of processes.

Process synchronization is for the realization of

 

- Multiprogramming

- Multiprocessing

- Distributed system

- Client-server model

 

The problem can occur in two ways 

 

1) When two processes have the accessibility of shared resources or variables.

Example: When two processes P1 and P2 try to update the value of the shared variable.

 

This problem leads to inconsistency and loss of data.

 

2) Due to cooperating processes where Execution of one process affects the other processes. 

Example: Producer-consumer problem. 

 

This problem leads to a deadlock.  

 

Global Shared Variable: This variable is accessible by multiple processes P1, P2,.....Pn.

Shared Resources: Resources like printer, memory, CPU, file and I/P device, etc. which can be shared among multiple processes.

Shared code: Code accessible by multiple processes. Example: Kernel Code.

 

To avoid such inconsistency problems, we introduced process synchronization to handle problems while concurrent processes occur. 

 

For example (Data Inconsistency problem)