Virtual Memory - Shared Memory (SHM)

Card Puncher Data Processing

About

Shared memory is the third type of memory.

It's 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 process. 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.

Although virtual memory allows processes to have separate address spaces, there are times when you need processes to share memory.

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.

Linux

  • In Linux, shared memory looks like a regular file system - /dev/shm (but is under the hood Tmpfs).
  • Linux supports the Unix TM System V shared memory IPC.

Documentation / Reference





Discover More
Data System Architecture
Asynchronous programming (Concurrency | Parallel)

application Asynchronous programming is notoriously difficult because the order of operations is highly unpredictable. From a classic computing perspective, concurrent and parallel are clearly synonyms...
Data System Architecture
Concurrency - (Shared) Memory Inconsistency

Errors that result from inconsistent views of shared memory. Memory consistency errors occur when different threads have inconsistent views of what should be the same data. The results of a write by...
Data System Architecture
Concurrency - Parallel Execution

Where a sequential execution can be imagined as a single worker on an assembly line moving between tasks, a parallel process is more like a series of workers, each doing a specific task. Parallelism...
Linux - Shared Memory (SHM) (/dev/shm)

Shared memory (SHM) in Linux. The shared memory system can also be used to set permissions on memory. There are two different types of shared memory implementations: System V IPC, and BSD mmap....
Cpu Memory Management Segmented Model
Memory - Segment

A memory segment is the division structure of the segmented memory model. The physical address spec (physical memory) of the primary memory is divide by segment. See virtual memoryvirtual segment ...
Process States
OS - Process (Main Thread) / Program

OS A process is the first thread started (called the main thread). It's the only thread that is authorized to start a new threads. A process is a unit of resources, while a thread is a unit of: scheduling...
Card Puncher Data Processing
OS - Virtual Memory

OS This section is the implement of memory by the OS called the virtual memory, a layer of memory management above physical memory Conceptually speaking, there are only three types of memory: Kernel...
Oracle Database Sga
Oracle Database - System Global Area - SGA (Shared Memory)

The SGA (System Global Area) is an area of memory allocated when an Oracle Instance starts up. The SGA memory is shared by all sessions connected to Oracle Instance. See A group of shared memory structures...
Data System Architecture
Parallel Programming - (Function|Operation)

A function or an operator has to be: commutative and associative in order to be computed correctly in parallel. A properly constructed operation is inherently parallelism, so long as the function(s)...
Multi Threading Puppies
Process - (Kernel) Thread (Lightweight processes - LWP)

A thread is a child unit of execution of a process (also known as the ). Threads exist within a process. A process acts as a container for threads. A process is a unit of resources, while a thread is...



Share this page:
Follow us:
Task Runner