Shared Memory Architecture
Shared Memory Architecture
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
• 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
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.