Process - Shared (Virtual) Memory (SHM)
1 - About
Shared memory is a way to shared state between process.
The structure that is shared is called a segment.
Shared memory, as its name implies, is a method to “share” data between processes. Both processes define the same memory area as “shared”, and they can then exchange information simply by writing into it. This (used to be, and still is somewhat) faster than the alternative of sending network or pipe-based messages between processes.
If you see the memory as a mean of storing data, a file on a file system can be seen as shared memory (ie shared file).
It is difficult to account for shared memory. Does it belong to one process? Both? Neither? If we naively sum the memory belonging to multiple processes, we grossly “over-count”.
As the name implies, the Shared (Virtual) Memory refers to virtual memory that are shared by more than one process and then can be used by multiple programs simultaneously.
Shared memory (SHM) is another method of interprocess communication (IPC) whereby several processes share a single chunk of memory to communicate.
Shared memory provides the fastest way for processes to pass large amounts of data to one another.