Skip to content
Related Articles

Related Articles

Difference between Shared Memory Model and Message Passing Model in IPC

View Discussion
Improve Article
Save Article
Like Article
  • Difficulty Level : Medium
  • Last Updated : 14 Jul, 2020

Prerequisite – Inter Process Communication
1. Shared Memory Model :
In this IPC model, a shared memory region is established which is used by the processes for data communication. This memory region is present in the address space of the process which creates the shared memory segment.The processes who want to communicate with this process should attach this memory segment into their address space.

2. Message Passing Model :
In this model, the processes communicate with each other by exchanging messages. For this purpose a communication link must exist between the processes and it must facilitate at least two operations send (message) and receive (message). Size of messages may be variable or fixed.

Difference between Shared Memory Model and Message Passing Model in IPC :

S.NoShared Memory ModelMessage Passing Model
1.Shared memory region is used for communication.Message passing facility is used for communication.
2.It is used for communication between processes on a single processor or multiprocessor systems where the communicating processes reside on the same machine as the communicating processes share a common address space.It is typically used in a distributed environment where communicating processes reside on remote machines connected through a network.
3.The code for reading and writing the data from the shared memory should be written explicitly by the Application programmer.No such code required here as the message passing facility provides mechanism for communication and synchronization of actions performed by the communicating processes.
4.It provides maximum speed of computation as communication is done through shared memory so system calls are made only to establish the shared memory.It is time consuming as message passing is implemented through kernel intervention (system calls).
5.Here the processes need to ensure that they are not writing to the same location simultaneously.It is useful for sharing small amounts of data as conflicts need not to be resolved.
6.Faster communication strategy.Relatively slower communication strategy

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!