DSM - Distributedsharedmemory
DSM - Distributedsharedmemory
( DSM )
Distributed shared memory
DSM paradigm provides process with shared address space
Primitives for shared memory:
– Read(address)
– Write(address , data)
Shared memory paradigm gives the systems illusion of
physically shared memory
DSM refers to shared memory paradigm applied to loosely
coupled distributed memory systems
Cont….
Shared memory exists only virtually
Similar concept to virtual memory
DSM also known as DSVM
DSM provides a virtual address space shared among
processes on loosely coupled processors
DSM is basically an abstraction that integrates the local
memory of different machine into a single logical entity
shared by cooperating processes
Distributed shared memory
DSM architecture
Each node of the system consist of one or more CPUs and
memory unit
Nodes are connected by high speed communication
network
Simple message passing system for nodes to exchange
information
Main memory of individual nodes is used to cache pieces
of shared memory space
Cont….
Memory mapping manager routine maps local memory to
shared virtual memory
Shared memory of DSM exist only virtually
Shared memory space is partitioned into blocks
Data caching is used in DSM system to reduce network
latency
The basic unit of caching is a memory block
The missing block is migrate from the remote node to the
client process’s node and operating system maps into the
application’s address space
Cont….
Data block keep migrating from one node to another on
demand but no communication is visible to the user
processes
If data is not available in local memory network block
fault is generated.
Design and implementation issues
Granularity
Structure of Shared memory
Memory coherence and access synchronization
Data location and access
Replacement strategy
Thrashing
Heterogeneity
Cont….
Granularity:
Granularity refers to the block size of DSM
The unit of sharing and the unit of data transfer
across the network when a network block fault occurs
Possible unit are a few word , a page or a few pages
Structure of Shared memory:
Structure refers to the layout of the shared data in
memory
Dependent on the type of applications that the DSM
system is intended to support
Cont…
Memory coherence and access synchronization:
In a DSM system that allows replication of shared
data item, copies of shared data item may
simultaneously be available in the main memories of
a number of nodes
To solve the memory coherence problem that deal
with the consistency of a piece of shared data lying in
the main memories of two or more nodes
Cont….
Thrashing:
Data block migrate between nodes on demand. Therefore
if two nodes compete for write access to a single data item
the corresponding data block may be transferred back.
Heterogeneity:
The DSM system built for homogeneous system need not
address the heterogeneity issue
Granularity
Most visible parameter in the design of DSM system is
block size
Factors influencing block size selection:
Sending large packet of data is not much more expensive
than sending small ones
Paging overhead: A process is likely to access a large
region of its shared address space in a small amount of
time
Therefore the paging overhead is less for large block size
as compared to the paging overhead for small block size
Cont…
Directory size:
The larger the block size, the smaller the directory
Ultimately result in reduced directory management
overhead for larger block size
Thrashing:
The problem of thrashing may occur when data item in
the same data block are being updated by multiple node at
the same time
Problem may occur with any block size, it is more likely
with larger block size
Cont…
False sharing:
No structuring:
The shared memory space is simply a linear array of words
Advantage:
Choose any suitable page size as the unit of sharing and a
fixed grain size may be used for all application
Simple and easy to design such a DSM system
Cont….
Following characteristics:
1. The replica location of a block never change
2. All replicas of a data block are kept consistent
3. Only a read request can be directly send to one of the
node having a replica.
Cont…
Cont….
A write operation on a block is sent to sequencer
The sequencer assign the next sequence number to
the requested modification
It then multicast the modification with this sequence
number to all the nodes listed in the replica set field.
Munin: A Release Consistent DSM System
Structure of Shared-Memory Space:
The shared memory space of Munin is structured as a
collection of shared variables.
The shared variables are declared with the keywords
shared so the compiler can recognized them.
Each shared variable, by default, is placed by the compiler
on a separate page.
Unit of data transfer across the network by MMU
hardware.
Implementation of Release
Consistency
Release consistency application must be modeled around
critical sections.
Munin provides two such synchronization mechanism.
A locking mechanism and a barrier mechanism.
The locking mechanism uses lock synchronization
variables with acquirelock and releasedlock primitives for
accessing these variables.
The acquirelock primitive with a lock variable as its
parameter is executed by a process to enter a critical
section .
Cont…
Releaselock primitive with the same lock variable
parameter is executed by the process to exit from the
critical section.
When a process makes an acquirelock request the system
first checks if the lock variable on the local node.
If not, the probable owner mechanism is used to find the
location owner of the lock variable and request is sent to
that node.
Cont….
The barrier mechanism uses barrier synchronization
variables with a waitAtBarrier primitive for accessing these
variables.
Barriers are implemented by using the centralized barrier
server mechanism.
In a network fault occur, the probable owner based
dynamic distributed server algorithm is used in Munin to
locate a page containing the accessed shared variables.
Annotation for shared variables
The release consistency of Munin allow applications to
have better performance than sequentially consistent DSM
system.
For further performance improvements, Munin defines
several standard annotation for shared variables.
The standard annotations and consistency protocol for
variables for variable for each type are as follows:
Cont…
1. Read-only
2. Migratory
3. Write-shared
4. Producer-consumer
5. Result
6. Reduction
7. Conventional
Cont…
Read-only
Shared-data variables annotated as read-only are immutable
data items
These variable are read but never written after initialization
Read-only variables are protected by the MMU hardware
Migratory
Shared variable that are accessed in phases, where each
phase correspondence to a series of accesses by a single
process, may be annotated as migratory variables
The locking mechanism is used to keep migratory variable
consistent
Cont…
Page migrate from one node to another on a demand basis,
but page are not replicated
Only one copy of a page containing a migrating variable
exists in the system
Write-shared:
A programmer may use this annotation with a shared
variable to indicate to the system that the variable is
updated concurrently by multiple processes
Munin avoid the false sharing problem of write shared
variable
Cont…
Write shared variable is replicated on all node
The process may perform several write to the page before
releasing it
When page is released, the system perform a word by
word comparison of the original page
When a node receives the differences of a modified page,
the system check if the local copy of the page was
modified
Cont…
Producer-consumer:
Shared variable that written (producer) by only one
process and read(consumed) by fixed set of other
processes may be annotated to be of producer-
consumer type
Minin uses an “ eager object movement” mechanism
Producer may send several update together by using
locking mechanism
In this case procedure acquires a synchronization
lock, make several update on the variable
Cont…
Result:
Result variable are just the opposite of producer-
consumer variable
They are written by multiple processes but read by only
one process
The variable is read only when all its parts have been
written
Munin uses a special write-update protocol for result
variable
Cont…
Reduction:
Shared variable that must be atomically modified may be
annotated to be of reduction type
Example: parallel computation application, a global
minimum must be atomically fetched and modified
For better performance a reduction variable is stored at a
fixed owner
Conventional:
Shared variable that are not annotated as one of the above
types are conventional variables
Page containing a conventional variable is dynamically
moved to the location of a process that want to perform a
write operation on the variable
Uses Write Invalidate
Replacement strategy
In DSM system that allow shared memory block to be
dynamically migrated/replicated
Following issue:
1. Which block should be replaced to make space for a newly
required block?
2. Where should the replaced block be placed?
Which block to replace
Classification of replacement algorithms:
1. Usage based verses non-usage based
2. Fixed space verses variable space
Usage based verses non-usage based:
Uses based algorithms keep track of the history of usage of a
cache line and use this information to make replacement
decisions eg. LRU algorithm
Non-usage-based algorithms do not take the record of use
of cache lines into account when doing replacement. First in
first out and Random (random or pseudorandom) belong to
this class
Cont…
Fixed space versus variable space:
Fixed-space algorithms assume that the cache size is fixed
while variable space algorithm are based on the
assumption that the cache size can be changed
dynamically depending on the need
In a variable space algorithm, a fetch does not imply a
replacement, and a swap-out can take place without a
corresponding fetch
Variable space algorithms are not suitable for a DSM
system
Cont…
In the first approach each node has its own memory and
access to a word in another nodes memory causes a trap to
the operating system then fetches and acquires the page.
Cont….
The second approach is to manage caching by MMU
Used in multiprocessors having hardware caches
DSM implementation is done either entirely or mostly
in hardware
The third approach is manage caching by language
runtime system
The DSM is structured not as a raw linear memory of
bytes from zero to total size of the combined memory
of all machine
Cont…
Placement and migration of shared variables/objects are
handled by the language runtime system in cooperation
with the operating system.
Advantage :Programming language may be provided with
features to allow programmers to specify the uses patterns
of shared variables/objects for their application
Heterogeneous DSM
A heterogeneous computing environment allow the
applications to exploit the best of all characteristics
features of several different types of computers.
Measurements made on their experimental prototype
heterogeneous DSM, called Mermaid.
Heterogeneous DSM is not only feasible but can also be
comparable in performance to its homogeneous
counterpart
The two issues in building a DSM system:
Data conversion and selection of block size
Machines of different architecture may used different bytes
ordering and floating point representation.
Structuring the DSM system as a collection
of source language objects
It is structured as a collection of variables or object so that
the unit of data migration is an object instead of a block
A suitable conversion runtime is used to translate the
object before migrating its to requesting node.
This method of data conversion is used in the Agora
shared memory system.
Array may easily be too large to be treated as unit of
sharing and data migration.
Allowing only one type of data in a
block
This mechanism is used in Mermaid which uses a
page size as its block size therefore , a page can
contain only one type of data.
Whenever a page is moved between two machines of
different architecture, a routine converts the data in
the page to the appropriate format
Limitations :
Allowing a page to content data of only one type may
lead to wastage of memory due to fragmentation,
resulting increased paging activity
Cont…
Compilers used of different types of machine must be
compatible
Another problem that entire pages are converted even
thought only a small portion may be accessed before it is
transferred away
The mechanism is not fully transparent
Another serious problem associated, accuracy of floating
point value in numerical applications
Block size selection
In the Homogeneous DSM system, the block size is
usually the same size as a native virtual memory (VM)
MMU hardware can be used to trigger a DSM block fault.
In heterogeneous, the virtual memory page size may be
different for machine of different types.
Block size selection become a complicated task
Following algorithm for block size selection:
1. Largest page size algorithm
2. Smallest page size algorithm
3. Intermediate page size algorithm
Cont…
In this method the DSM block size is taken as the largest
VM page size of all machines
Algorithm suffers from the same false sharing and
thrashing problem
The DSM block size is taken as the smallest VM page size
of all machines
This algorithm reduced data contention, its suffer from
the increase communication and block table management
over heads.
To balance between the problem of large and small size
blocks a heterogeneous DSM system, choose largest VM
page size and smallest VM page size
Advantage of DSM
Simpler Abstraction:
The shared memory programming paradigm shields the
application programmers from many such low level concern
Advantage:
It is simple abstraction its provide to the application
programmers of loosely coupled distributed memory
machine.