Docsity

Distributed Shared Memory - Lecture Slides | CS 4210, Papers of Operating Systems

Partial preview of the text

Download Distributed Shared Memory - Lecture Slides | CS 4210 and more Papers Operating Systems in PDF only on Docsity!

Distributed Shared Memory

Based on Reference paper: Distributed SharedMemory, Concepts and Systems

Shared Memory

We have already seen some kinds of shared memorymechanisms •^ shared memory symmetric multiprocessors:^ –^ all memory is shared and equidistant from processors^ –^ caching is used for performance There are also other kinds of shared memory approaches •^ NUMA (non-uniform memory access) machines^ –^ each machine has its own memory but the

hardware^ allows accessing remote memory – remote addresses are no different than local accesses at theassembly level – access to remote memory is much slower – no hardware caching occurs (but the software may docaching)

-^ objectives:^ minimize latency

and^ keep coherent

Distributed Shared Memory • software presents the abstraction of sharedmemory • either an OS or a language run-time managesthe shared memory • there are many different DSM granularities^ –^ page-based DSM: like regular virtual memory(e.g., Clouds here at Tech!)^ –^ shared-variable DSM and object-based DSM:managed by a language run-time system

Implementation

-^ Think of how you would implement such a“virtual”^ shared memory among workstations^ –^ Software: at the OS level for unsuspecting processes^ •^ how can this be done efficiently?^ –^ Software: at a language runtime level (e.g., Java VM)^ •^ how can it be done without hardware support?^ –^ Hardware level support^ •^ most efficient, but costly; many exotic interconnects have somesupport (Quadrics, Infiniband…)^ –^ Hybrid

Granularity tradeoffs • finer granularity – improve concurrency, increase communicationand frequency of execution of consistency relatedprotocols • coarser granularity – limit concurrency (especially is single writer only),reduce comm/consistency protocols – issue with false sharing • may be able to reduce with careful layout of datastructures, hard if implemented at system/hardwarelevel

Objective: Reduce Latency • Approach: –^ migration^ •^ migrate shared unit (page, object, etc.) to nodewhich has current access -> need state todetermine current location –^ replication^ •^ keep multiple copies -> need per shared unitstate for keeping track of replicas, and types ofaccess at each replica

DSM vs. other shared memorymechanisms • We have seen simple cache consistency mechanisms in twodifferent settings: – SMPs^ (snooping caches, shared bus, write-update or write- invalidate protocols, write buffers, etc.) – distributed file systems (client or server-based protocols, leases,invalidation, delayed writes) • Similar mechanisms apply to DSM, but they have to be moresophisticated – DSM will be used for synchronization and inter-processcommunication – DSM has to be very fast – comparable in speed to memory, not to a file system – caching is paramount – no central resources exist (like a bus we can snoop on or lock itcheaply)

Page-based DSM • The issues in implementing DSM are similar to whatwe have seen so far, but some complications arise inthe page-based case – which is the most common case for getting DSMrunning on machines with no shared memorysupport in hardware (e.g., workstations overethernet) • Pages are coarse grained—false sharing may occur – extra invalidations in a write-invalidate protocol – possibly overwriting other data in a write-updateprotocol • Realistically, write-invalidate is the only option forpage-based DSM – hard to do updates on every write: protection is atpage granularity

Write-invalidate protocol • Not particularly exciting—usually straightforwardand exactly what you would expect • Interesting point: the “owner”

of a page can be changing (e.g., can be the last writer to the page) • The owner is responsible for blocking “writes”

until

all outstanding copies have been invalidated • How to find the owner?^ –^ directories^ –^ distributed directories (statically or dynamically)^ –^ hints (probable owner, owner links, and periodicbroadcasts so that all processors know a recentowner)

Synchronization • Strict synchronization (e.g., mutualexclusion) can be too costly in DSM – spinlocks are a disaster as they requiretransferring pages only to find out that thelock is still busy • A centralized synchronization managermay exist