Open In App

Difference between Shared Memory Model and Message Passing Model in IPC

Last Updated : 06 Sep, 2022
Improve
Improve
Like Article
Like
Save
Share
Report

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 that 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). The size of messages may be variable or fixed. 

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

S.No Shared Memory Model Message Passing Model
1. The shared memory region is used for communication. A 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 a 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.
7. No kernel intervention. It involves kernel intervention.
8. It can be used in exchanging larger amounts of data.  It can be used in exchanging small amounts of data.
9.

Example- 

  • Data from a client process may need to be transferred to a server process for modification before being returned to the client.

Example- 

  • Web browsers
  • Web Servers
  • Chat program on WWW (World Wide Web)

Similar Reads

IPC through shared memory
Inter Process Communication through shared memory is a concept where two or more process can access the common memory and communication is done via this shared memory where changes made by one process can be viewed by another process. The problem with pipes, fifo and message queue – is that for two process to exchange information. The information h
3 min read
Difference between Shared Nothing Architecture and Shared Disk Architecture
1. Shared Nothing Architecture : Shared nothing architecture is an architecture that is used in distributed computing in which each node is independent and different nodes are interconnected by a network. Every node is made of a processor, main memory, and disk. The main motive of this architecture is to remove the contention among nodes. Here the
3 min read
IPC using Message Queues
Prerequisite : Inter Process Communication A message queue is a linked list of messages stored within the kernel and identified by a message queue identifier. A new queue is created or an existing queue opened by msgget(). New messages are added to the end of a queue by msgsnd(). Every message has a positive long integer type field, a non-negative
3 min read
Message based Communication in IPC (inter process communication)
Prerequisites - Cloud computing, Load balancing in Cloud Computing, Inter-process Communication In the development of models and technologies, message abstraction is a necessary aspect that enables distributed computing. Distributed system is defined as a system in which components reside at networked communication and synchronise its functions onl
5 min read
Message Passing Model of Process Communication
So message passing means how a message can be sent from one end to the other end. Either it may be a client-server model or it may be from one node to another node. The formal model for distributed message passing has two timing models one is synchronous and the other is asynchronous. The fundamental points of message passing are: In message-passin
3 min read
Difference between Parallel Virtual Machine (PVM) and Message Passing Interface (MPI)
1. Parallel Virtual Machine (PVM) : PVM is a type of software tool which is designed for heterogeneous distributed computing. This software was created at the Oak Ridge National Laboratory in 1989 and it was rewritten in 1991 at the university of Tennessee. In this system, it allows a heterogeneous network which can be made from a collection of dis
2 min read
Difference between Time Shared Bus, Crossbar Switch & Multiport Memory - Interconnection structure
Prerequisite : Detailed study about the Time Shared Bus, Crossbar Switch & Multiport Memory interconnection structure. Introduction :Interconnection structure can decide the overall system's performance in a multi-processor environment. The processors must be able to share a set of main memory modules & I/O devices in a multiprocessor syste
2 min read
Differences between Dynamic Binding and Message Passing in Java
Dynamic Binding: In Dynamic binding compiler doesn’t decide the method to be called. Overriding is a perfect example of dynamic binding. In overriding both parent and child classes have the same method. Dynamic binding is also called Late binding. Message Passing: Message Passing in terms of computers is communication between processes. It is a for
3 min read
What is Distributed shared memory and its advantages
DSM is a mechanism that manages memory across multiple nodes and makes inter-process communications transparent to end-users. The applications will think that they are running on shared memory. DSM is a mechanism of allowing user processes to access shared data without using inter-process communications. In DSM every node has its own memory and pro
3 min read
Message Passing in Java
What is message passing and why it is used? Message Passing in terms of computers is communication between processes. It is a form of communication used in object-oriented programming as well as parallel programming. Message passing in Java is like sending an object i.e. message from one thread to another thread. It is used when threads do not have
3 min read