written 7.0 years ago by | modified 5.7 years ago by |
Subject: Operating System
Topic: Synchronization and Deadlocks
Difficulty: Medium
written 7.0 years ago by | modified 5.7 years ago by |
Subject: Operating System
Topic: Synchronization and Deadlocks
Difficulty: Medium
written 5.7 years ago by |
Process synchronization
Each process executes its own operations on shared variables sequentially, as specified by its own program. Nevertheless, different processes may execute their operations on the same shared variable concurrently. That is, operation executions of different processes may overlap, and they may affect one another.
Each operation on a shared variable, when executed indivisibly, transforms the variable from one consistent value to another. However, when the operations arc executed concurrently on a shared variable, the consistency of its values may not the guaranteed.
The behaviors of operation executions on shared variables must, be predictable for effective inter-process communication.
Thus, operation executions on shared variables may need to be coordinated to ensure their consistency semantics.
Coordination of accesses to shared variables is called synchronization.
A synchronization solution coordinates accesses from processes to shared variables. As shown in Figure, where all accesses to shared variables are channeled through access controllers
Inter-Process Communication:
Inter-Process Communication (IPC) is the activity of sharing data across multiple and commonly specialized processes using communication protocols.
Typically, applications using IPC are categorized as clients and servers.
Client requests data and the Server responds to client requests.
IPC has ability to communicate between two cooperating process.
IPC is used in many contexts, such as a producer – consumer problem.
I) Pipes:
It is simplest of all the IPCs.
A pipe enables one way communication between a processes.
When process terminates, pipe is removed automatically.
II) FIFO:
FIFO Stands for First In First Out.
It is also called as Named Pipes.
A FIFO enables unidirectional communication between a processes.
III) Message Queue:
It is used in implementation of Message Passing IPC.
Message Queue will remain, even if the process have existed.
It can be unidirectional or bidirectional.
IV) Shared Memory:
It includes a memory segment which is shared by two or more processes.
When a process creates a memory segment for IPC from its logical address space.
Other process can attach that available space for communication.
Shared Memory is one of the most simplest & Logical Implementation of IPC.