Reaves.dev

v0.1.0

built using

Phoenix v1.7.17

Shared Memory Machines

Stephen M. Reaves

::

2024-01-30

Notes about Lecture 4a for CS-6210

Summary

Shared Memory Model

Dance Hall Architecture

Gcpu1CPUcache1cachecpu1--cache1cpu2CPUcache2cachecpu2--cache2cpu3CPUcache3cachecpu3--cache3inInterconnection Networkcache1--incache2--incache3--inm1Memoryin--m1m2Memoryin--m2m3Memoryin--m3

Cache specified per CPU

All CPUs have access to all memory

Symmetric Multi Processor

Gcpu1CPUcache1cachecpu1--cache1cpu2CPUcache2cachecpu2--cache2cpu3CPUcache3cachecpu3--cache3buscache1--buscache2--buscache3--businMain Memorybus--in

All cpus have acces to the bus

Symmetric because access times are all the same

Distributed Shared Memory Architecture

Gcpu1CPUcache1cachecpu1--cache1cpu2CPUcache2cachecpu2--cache2cpu3CPUcache3cachecpu3--cache3p1cache1--p1p2cache2--p2p3cache3--p3m1Memorym1--p1m2Memorym2--p2m3Memorym3--p3inInterconnection Networkp1--inp2--inp3--in

CPUs still all have access to each others memory, but it’s faster to access the memory in your tree

Shared Memory and Caches

Using a system bus (like with the SMP), CPU can access cache and only wait ~2 cycles, but may take +100 cycles to get main memory.

CPU access and cache works identically to single cpu systems except for shared mutable data

Memory Consistency and Cache Coherence

Memory Consistency answers the question, “What is the model presented to the programmer?”.

Cache coherence answers the question, “How is the system implementing the model in the presence of private caches?”.

Hardware Cache Coherence

Write Invalidate

Write Update

Scalability

When you add processors, you can exploit parallelism, but you increase overhead

If you want good performance, don’t share memory across threads, as much as possible.

Shared memory machines scale well when you don’t share memory.

Chuck Thacker