In this tutorial, you will learn about the various working capabilities of IPC (Inter-process communication) within an Operating system, along with usage. Processes executing concurrently in the operating system might be independent or cooperating. A process is independent if it cannot be affected by the other processes running in the system.

Basics of Interprocess Communication (IPC)

There are numerous reasons for providing an environment or situation that allows process cooperation:

  • Information sharing: Since some users may be interested in the same piece of information (for example, a shared file), you must provide a situation for allowing concurrent access to that information.
  • Computation speedup: If you want a particular work to run fast, you must break it into sub-tasks where, each of them will get executed in parallel with the other tasks. Note that such a speedup can be attained only when the computer has compound or various processing elements like CPUs or I/O channels.
  • Modularity: You may want to build the system modularly by dividing the system functions into split processes or threads.
  • Convenience: A single user may work on many tasks simultaneously. For example, a user may edit, format, print, and compile in parallel.

Working together with multiple processes requires an interprocess communication (IPC) method, allowing them to exchange data and various information. There are two primary models of interprocess communication:

  1. shared memory and
  2. message passing.

In the shared-memory model, a memory region shared by cooperating processes gets established. Processes can then exchange information by reading and writing all the data to the shared region. In the message-passing form, communication occurs through messages exchanged among the cooperating processes.

The two communications models are contrasted in the figure below:

Shared Memory Systems

Interprocess communication (IPC) usually utilizes shared memory, which requires communicating processes to establish a shared memory region. Typically, a shared-memory region resides within the address space of any process creating the shared memory segment. Other processes that wish to communicate using this shared-memory segment must connect it to their address space.

More on Inter-Process Shared Memory

Note that, usually, what happens is that the operating system tries to check one process from accessing another process's memory. Shared memory requires two or more processes to agree to remove this limitation. They can then exchange information via reading and writing data within the shared areas.

These processes establish the form of the data and the location and are not controlled by the operating system. The processes are also in charge to ensure they are not writing to the exact old location simultaneously.

Found This Page Useful? Share It!
Get the Latest Tutorials and Updates
Join us on Telegram