Shared Memory is one of the IPC(Inter process communication) and it is used when we want to share large amount of data.
What is Shared Memory in IPC ?
Shared Memory is the memory(access as like malloc or new) created by one process and other process or processes can attache the same memory, if any change is made by one process then same would be seen by other processes.
Advantage:
- It is used when we want to share large amount of data.
- It is very fast way of communication.
Disadvantage:
- Synchronisation is not provided by system and its user responsibility.
Diagram:
Header file:
Main API’s:
Source code:
Output: