Process Communication in Operating System


Processes that executing concurrently in the operating system may be either independent processes or cooperating processes. if a process cannot affect or be affected by the other processes executing in the system then the process is said to be independent. So any process that does not share any data with any other process is independent. A process is said to be cooperating if it can affect or be affected by the other processes executing in the system. So it is clear that, any process which shares its data with other processes is a cooperating process.

There are many reasons for providing an environment that allows process cooperation −

  • Information sharing - Since several users may be interested in the same piece of information (for instance, a shared file), we must provide an environment to allow concurrent access to such information.

  • Computation speedup - If we want a particular task to run faster, we must break it into subtasks, each of which will be executing in parallel with the others.

  • Modularity - We can construct the system in a modular fashion, dividing the system functions into separate processes or threads.

  • Convenience - Even an individual user can work on many tasks at the same time like a user can be editing, listening to music, and compiling in parallel.

Cooperating processes need an inter-process communication (IPC) mechanism that will allow them to exchange data and information. Two basic models of inter-process communication are there: shared memory and message passing. A region of memory that is shared by cooperating processes is established, in shared-memory model.

Processes can then exchange their information by reading and writing data to the shared region. In message-passing model, communication takes place by means of messages exchanged between the cooperating processes. The two communications models are contrasted in Figure below. Both of the models which are mentioned, common in operating systems, and many systems implement both. Message passing is needful for exchanging smaller amounts of data, because no conflicts need be avoided. It is also easier to implement in a distributed system than shared memory. Once shared memory is initiated, all accesses are treated as routine memory accesses, and no assistance from the kernel is required. It suffers from cache coherency issues, which arise because shared data migrate among the several caches. Since the number of processing cores on systems increases, it is possible that we will see message passing as the preferred mechanism for IPC.

Figure: Communication Models

Updated on: 17-Oct-2019

4K+ Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements