0% found this document useful (0 votes)
75 views

Shared Memory Architecture

Class notes of Parallel Distributed Computing

Uploaded by

muhammad.786685
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
75 views

Shared Memory Architecture

Class notes of Parallel Distributed Computing

Uploaded by

muhammad.786685
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 17

Shared Memory

Architecture
Lecture 5
The Agenda

1. Shared Memory
2. Shared Memory Architecture
3. Shared Memory at Hardware level
4. Shared Memory at Software level
MEMORY
HIRARCHY IN
CPU
MEMORY HIRARCHY
Shared Memory Definition

• Shared memory is the memory which all the processors can access
simultaneously.
• Processors have direct access to the common physical memory through bus
based (usually using wires) access.
• These processors can work independently while they all access the same
memory. Any change in the variables stored in the memory is visible by all
processors
• At any given moment all they see is a copy or picture of entire variables
stored in the memory and they can directly address and access the same
logical memory locations regardless of where the physical memory actually
exists.
Shared Memory

• Shared memory is memory that 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.

• Shared memory concept is not only existed at hardware. It is rather a joint


venture of Hardware and Software,
Shared Memory cont…
Hardware Level
• 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 cont…
Hardware Level
• In shared memory systems following different approaches may followed:
• Uniform memory Access (UMA): all the processors share the physical memory
uniformly (e.g. access time is same etc.);

• 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.
Shared Memory cont…
Hardware Level
Shared Memory cont…
Hardware Level
• An Advantage: 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 a same location.
Shared Memory cont…
Hardware Level
• A Challenge: 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 same memory location it
causes contention. Trying to access nearby memory locations may cause false sharing.

• 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.
Shared Memory cont…
Hardware Level

Incoherent caches: The caches have different values of a single


address location.
Shared Memory cont…
Hardware Level

Coherent caches: The data in all the caches' copies is the same.
Shared Memory cont…
Hardware Level
• A Challenge: 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 same memory
location it causes contention. Trying to access nearby memory locations may cause
false sharing.

• 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.
Shared Memory cont…
Software Level
• At software level, 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.

• 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.
Shared Memory cont…
Software Level
• Since both processes can access the shared memory area like
regular working memory, this is a very fast way of
communication.

• On the other hand, it is less scalable, 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.

You might also like