- Trending Categories
- Data Structure
- Operating System
- C Programming
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Differentiate between shared memory and message passing model in OS.
Shared memory system is the fundamental model of inter process communication. In a shared memory system, in the address space region the cooperating communicate with each other by establishing the shared memory region.
Shared memory concept works on fastest inter process communication.
If the process wants to initiate the communication and it has some data to share, then establish the shared memory region in its address space.
After that, another process wants to communicate and tries to read the shared data, and must attach itself to the initiating process’s shared address space.
Message Passing provides a mechanism to allow processes to communicate and to synchronize their actions without sharing the same address space.
For example − Chat program on the World Wide Web.
Message passing provides two operations which are as follows −
Messages sent by a process can be either fixed or variable size.
For fixed size messages the system level implementation is straight forward. It makes the task of programming more difficult.
The variable sized messages require a more system level implementation but the programming task becomes simpler.
If process P1 and P2 want to communicate they need to send a message to and receive a message from each other that means here a communication link exists between them.
The major differences between shared memory and message passing model −
|Shared Memory||Message Passing|
|It is one of the region for data communication||Mainly the message passing is used for communication.|
|It is used for communication between single processor and multiprocessor systems where the processes that are to be communicated present on the same machine and they are sharing common address space.||It is used in distributed environments where the communicating processes are present on remote machines which are connected with the help of a network.|
|The shared memory code that has to be read or write the data that should be written explicitly by the application programmer.||Here no code is required because the message passing facility provides a mechanism for communication and synchronization of actions that are performed by the communicating processes.|
|It is going to provide a maximum speed of computations because the communication is done with the help of shared memory so system calls are used to establish the shared memory.||Message passing is a time consuming process because it is implemented through kernel (system calls).|
|In shared memory make sure that the processes are not writing to the same location simultaneously.||Message passing is useful for sharing small amounts of data so that conflicts need not occur.|
|It follows a faster communication strategy when compared to message passing technique.||In message passing the communication is slower when compared to shared memory technique.|
|Given below is the structure of shared
memory system −||Given below is the structure of message
passing system −|
- Difference between Shared Memory Multiprocessors and Message-Passing Multiprocessors in Computer Architecture.
- Message Passing vs Shared Memory Process communication Models
- What is shared memory in the OS?
- What is message passing technique in OS?
- Shared Memory Model of Process Communication
- Message Passing Model of Process Communication
- What is shared-memory model in computer architecture?
- Differentiate between OS and DBMS files and OS and DBMS buffer manager
- Difference Between Virtual and Cache Memory in OS
- Differentiate between process switch and mode switch in OS
- Differentiate between Circuit Switching, Message Switching, and Packet Switching
- IPC through shared memory
- Difference between Network OS and Distributed OS
- Java Memory Model
- Algorithm for implementing Distributed Shared Memory