
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Message Passing vs Shared Memory Process Communication Models
Message passing model and shared memory model are models of interprocess communication. Details about these are given as follows −
Message Passing Process Communication Model
Message passing model allows multiple processes to read and write data to the message queue without being connected to each other. Messages are stored on the queue until their recipient retrieves them. Message queues are quite useful for interprocess communication and are used by most operating systems.
A diagram that demonstrates message passing model of process communication is given as follows −
In the above diagram, both the processes P1 and P2 can access the message queue and store and retrieve data.
An advantage of message passing model is that it is easier to build parallel hardware. This is because message passing model is quite tolerant of higher communication latencies. It is also much easier to implement than the shared memory model.
However, the message passing model has slower communication than the shared memory model because the connection setup takes time.
Shared Memory Process Communication Model
The shared memory in the shared memory model is the memory that can be simultaneously accessed by multiple processes. This is done so that the processes can communicate with each other. All POSIX systems, as well as Windows operating systems use shared memory.
A diagram that illustrates the shared memory model of process communication is given as follows:
In the above diagram, the shared memory can be accessed by Process 1 and Process 2.
An advantage of shared memory model is that memory communication is faster as compared to the message passing model on the same machine.
However, shared memory model may create problems such as synchronization and memory protection that need to be addressed.