0% found this document useful (0 votes)
79 views4 pages

Shared Memory

Shared memory is a memory system that allows multiple programs or processors to access the same memory space simultaneously, facilitating communication and reducing redundancy. It can be implemented in hardware with various architectures like UMA, NUMA, and COMA, but faces challenges such as access contention and data coherence. In software, shared memory serves as a method for inter-process communication and memory conservation, offering fast communication but limited scalability, as it typically requires processes to run on the same machine.

Uploaded by

Ramesh B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
79 views4 pages

Shared Memory

Shared memory is a memory system that allows multiple programs or processors to access the same memory space simultaneously, facilitating communication and reducing redundancy. It can be implemented in hardware with various architectures like UMA, NUMA, and COMA, but faces challenges such as access contention and data coherence. In software, shared memory serves as a method for inter-process communication and memory conservation, offering fast communication but limited scalability, as it typically requires processes to run on the same machine.

Uploaded by

Ramesh B
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 4

Shared memory

An illustration of a shared
memory system of three processors
In computer science, shared memory is memory that may
be simultaneously accessed by multiple programs with an
intent to provide communication among them or avoid
redundant copies. Shared memory is an efficient means of
passing data between programs. Depending on context,
programs may run on a single processor or on multiple
separate processors.
Using memory for communication inside a single program,
e.g. among its multiple threads, is also referred to as
shared memory.

In hardware

HSA defines a special case of


memory sharing, where the MMU of the CPU and
the IOMMU of the GPU have an identical pageable virtual
address space.
In computer hardware, shared memory refers to a (typically
large) block of random access memory (RAM) that can be
accessed by several different central processing
units (CPUs) in a multiprocessor computer system.
Shared memory systems may use:[1]
 uniform memory access (UMA): all the processors share
the physical memory uniformly;
 non-uniform memory access (NUMA): memory access
time depends on the memory location relative to a
processor;
 cache-only memory architecture (COMA): the local
memories for the processors at each node is used as
cache instead of as actual main memory.
A shared memory system is relatively easy to program
since all processors share a single view of data and the
communication between processors can be as fast as
memory accesses to the same location. The issue with
shared memory systems is that many CPUs need fast
access to memory and will likely cache memory, which has
two complications:
 access time degradation: when several processors try to
access the same memory location it causes contention.
Trying to access nearby memory locations may
cause false sharing. Shared memory computers cannot
scale very well. Most of them have ten or fewer
processors;
 lack of data coherence: whenever one cache is updated
with information that may be used by other processors,
the change needs to be reflected to the other processors,
otherwise the different processors will be working with
incoherent data. Such cache coherence protocols can,
when they work well, provide extremely high-
performance access to shared information between
multiple processors. On the other hand, they can
sometimes become overloaded and become a bottleneck
to performance.
Technologies like crossbar switches, Omega
networks, HyperTransport or front-side bus can be used to
dampen the bottleneck-effects.
In case of a Heterogeneous System Architecture (processor
architecture that integrates different types of processors,
such as CPUs and GPUs, with shared memory),
the memory management unit (MMU) of the CPU and
the input–output memory management unit (IOMMU) of the
GPU have to share certain characteristics, like a common
address space.
The alternatives to shared memory are distributed
memory and distributed shared memory, each having a
similar set of issues.

In software
In computer software, shared memory is either
 a method of inter-process communication (IPC), i.e. a
way of exchanging data between programs running at
the same time. One process will create an area
in RAM which other processes can access;
 a method of conserving memory space by directing
accesses to what would ordinarily be copies of a piece of
data to a single instance instead, by using virtual
memory mappings or with explicit support of the program
in question. This is most often used for shared
libraries and for Execute in place (XIP).
Since both processes can access the shared memory area
like regular working memory, this is a very fast way of
communication (as opposed to other mechanisms of IPC
such as named pipes, Unix domain sockets or CORBA). On
the other hand, it is less scalable, as for example the
communicating processes must be running on the same
machine (of other IPC methods, only Internet domain
sockets—not Unix domain sockets—can use a computer
network), and care must be taken to avoid issues if
processes sharing memory are running on separate CPUs
and the underlying architecture is not cache coherent.
IPC by shared memory is used for example to transfer
images between the application and the X server on Unix
systems, or inside the IStream object returned by
CoMarshalInterThreadInterfaceInStream in the COM
libraries under Windows.
Dynamic libraries are generally held in memory once and
mapped to multiple processes, and only pages that had to
be customized for the individual process (because a symbol
resolved differently there) are duplicated, usually with a
mechanism known as copy-on-write that transparently
copies the page when a write is attempted, and then lets
the write succeed on the private copy.
Compared to multiple address space operating systems,
memory sharing -- especially of sharing procedures or
pointer-based structures -- is simpler in single address
space operating systems.[2]

You might also like