Distributed Shared Memory in Distributed Computing

download Distributed Shared Memory in Distributed Computing

of 23

Transcript of Distributed Shared Memory in Distributed Computing

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    1/23

    3/7/13

    Distributed SharedMemory

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    2/23

    3/7/13

    as c para gms or nDC

    Shared Memory

    Message passing.

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    3/23

    3/7/13

    Introduction to DSM

    Shared memory is used in tightlycoupled systems.

    loosely coupled systems are usingmsg passing or RPC.

    But how to use shared memory on

    loosely coupled??

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    4/23

    3/7/13 44

    DSM History

    Memory mapped files started in theMULTICS operating system in the1960s

    One of the first DSM implementationswas Apollo. One of the first system touse Apollo was Integrated shared

    Virtual memory at Yale (IVY) DSM developed in parallel with

    shared-memory multiprocessors

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    5/23

    3/7/13

    Distributed shared memory

    Topics covered :

    Architecture

    design issues structure of shared memory space

    replacement strategy

    thrashing

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    6/23

    3/7/13

    How DSM implemented???

    A Software layer on top of messagepassing system to provide sharedmemory abstraction.

    Gives an illusion of physically sharedmemory.

    The software layer can beimplemented on os kernel or runtime library with kernel support.

    DSM is the shared memory paradigma lied to loosel cou led distributed

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    7/23

    3/7/13

    DSM.

    That is DSM is basically anabstraction that integrates the localmemory of different machines in a

    network environment into a singlelogical entity shared by cooperatingprocess executing on multiple site.

    Shared memory exists only virtually. Sharing with the help of

    replication/migration

    So DSM also called as Distributed

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    8/232008, Pham Quoc Cuon Phan DinhDistributed Shared Memory 8Distributed Shared Memory

    DSM vs Message passing

    DSM Message passing

    Variables are shared directly Variables have to be marshalledyourself

    Processes can cause error to oneanother by altering data

    Processes are protected from oneanother by having private address

    spaces

    Processes may execute with non-overlapping lifetimes

    Processes must execute at thesame time

    Invisibility of communicationscost

    Cost of communication is obvious

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    9/23

    3/7/13 99Distributed

    Distributed Shared Memory

    Distributed Shared Memory (DSM) allowsprograms running on separate computersto share data without the programmerhaving to deal with sending messages

    Instead underlying technology will sendthe messages to keep the DSM consistent(or relatively consistent) betweencomputers

    DSM allows programs that used to operateon the same computer to be easilyadapted to operate on separate computers

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    10/23

    3/7/13

    General Architecture of DSMsystems

    A software memory mappingmanager routine in each node mapsthe local memory onto the shared

    virtual memory . To facilitate the mapping operation,

    the shared memory space is

    partitioned into blocks Memory access latency- network

    latency can be reduced by data

    caching.

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    11/23

    3/7/13 1111Distributed

    The distributed shared memoryabstractionDistributed Shared Memory

    (exists only virtually)

    CPU 1

    CPU n

    Memory

    Memory-MappingManager

    CPU 1

    CPU n

    Memory

    Memory-MappingManager

    CPU 1

    CPU n

    Memory

    Memory-MappingManager

    Communication Network

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    12/23

    3/7/13

    Design and Implementationissue of DSM.

    1. Granularity: refers to block size. Unit of sharing or unit of data transfer

    Possible units are few words , a page ora few pages.

    Determines the measure of parallelismand amount of traffic

    2. Structure of Shared Memoryspace:

    layout of shared data in memory

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    13/23

    3/7/13

    Design and Implementationissue of DSM cont..

    3. Memory Coherence andaccess Synchronization:

    Coherence means consistency : relatedto replicated data.

    Concurrent access to the shared datamay be there

    Synchronization primitives likesemephores, event count, and locketc..may be used

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    14/23

    3/7/13

    Design and Implementationissue of DSM cont..

    4. Data location and access: Data block locating mechanism.

    5. Replacement Strategy: When local memory of a node is full and

    Cache miss occurs

    6. Thrashing: Data block migrating between nodes on

    demand.

    Blocks transfer at high rate so that no

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    15/23

    3/7/13

    Design and Implementationissue of DSM cont..

    7. Heterogeneity:

    To function properly with machines

    with different architectures.

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    16/23

    3/7/13

    Structure of shared memory

    Structure and granularity are closelyrelated

    Commonly used approaches for

    structuring are : No structuring :

    unstructured shared memory, can choosesuitable page size and a fixes grain size

    Structuring by data type :

    Structured as collection of objects orvariables ,so variable grain size

    Structuring as a database

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    17/23

    3/7/13

    Replacement strategy

    In DSM blocks are dynamicallymigrated / replicated

    Issues addressed

    Which block should be replaced to makespace for newly required block?

    Where should the replaced block beplaced?

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    18/23

    3/7/13

    Which block to replace?

    Usage based versus non usagebased(LRU, FIFO, Rand)

    Fixed space versus variable space

    Based priority mechanism unUsed : block that is not currently

    being used

    Nil : block that has been invalidated

    Read only : block for which the nodehas only read access right

    Read owned : block for which the node

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    19/23

    3/7/13

    Which block to replace

    Replacement Priority

    Used and nil : highest replacementpriority

    Read only : next replacement priority,copy of the block will be there availableat the owner , can be brought if

    required. Read owned and writable blocks for

    which replicas exit on other nodes : nextreplacement priority

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    20/23

    3/7/13

    Where to replace??

    Blocks selected for replacementhaving useful information need notbe discarded eg : writable, read

    owned blocks etc. Approaches for storing replaced

    blocks are:

    Using secondary mry

    Using the mry space of other nodes

    By keeping tack of free mry space at other

    nodes in the system

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    21/23

    3/7/13

    Thrashing

    Serious performance problem

    Because of poor locality of reference

    Large amount of time wastedtransferring shared data blocks fromone node to another, than doinguseful work

    Thrashing occurs when networkresources are exhausted, and moretime is spent invalidating data andsendin u dates than is used doin

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    22/23

    3/7/13

    Thrashing occurs..

    When interleaved data access madeby processes on two or more nodescauses a data block to move back

    and forth from one node to anotheron quick succession

    When blocks with read only

    permission are repeatedlyinvalidated soon after they arereplicated.

  • 7/29/2019 Distributed Shared Memory in Distributed Computing

    23/23

    3/7/13

    Methods to solve trashing

    Providing application controlled locks

    Nailing a block to a node for aminimum amount of time

    Tailoring the coherence algorithm tothe shared data usage patterns.