of 21
7/30/2019 Distributed Shared Memory for Advanced Os
1/21
DISTRIBUTED SHARED MEMORY
By
M.Spinoza
7/30/2019 Distributed Shared Memory for Advanced Os
2/21
Distributed Shared Memory
Introduction
Architecture
Advantages of DSM. Algorithms
Memory Coherence
Coherence protocols Design Issues.
7/30/2019 Distributed Shared Memory for Advanced Os
3/21
Introduction
Distributed Computing
It is based on the message Passing Model in which processes
interact and share data in the form of messages.
Ex: Client-Server Model, RPC,Hoares
CSP.Distributed Shared Memory (DSM)
DSM System is a resource Management Component of a Distributed
Operating System that implements the Shared Memory model in
distributed systems, which have no physically shared memory. The shared memory model provides a virtual address space that is
shared among all nodes in a distributed system.
7/30/2019 Distributed Shared Memory for Advanced Os
4/21
Architecture and Motivation
In DSM, programs access data in the
shared address space just as in traditional
virtual memory.
Each node can own data stored in the
shared address space and the ownership can
change when data moves from one node to
another.
Mapping Manager maps the shared memory address to the physical
memory. It is a layer of software implemented either in the operating
system kernel or as a runtime library routine.
7/30/2019 Distributed Shared Memory for Advanced Os
5/21
Advantages of DSM
DSM Systems hides the explicit data movement and hence it iseasier to design and write parallel algorithms using DSM.
It allows complex data structures to be passed by reference thus
simplifies the development of algorithms for distributed
applications. DSM takes advantage of locality of reference exhibited by
programs and thereby cuts down on the overhead of
communicating over the network.
DSM is cheaper to build than the tightly coupled multiprocessorsystems.
It has increased processor speed and memory speed .
DSM can be easily scaled upwards.
Highly portable.
7/30/2019 Distributed Shared Memory for Advanced Os
6/21
Algorithms for Implementing DSM
Issues
1. How to keep track of the location of remote data?
2. how to overcome the communication delays and highoverhead?
3. how to make shared data concurrently accessible?
Algorithms
There are 4 basic algorithms to implement DSM systems
Central Server Algorithm
Migration Algorithm
Read-Replication Algorithm
Full Replication Algorithm
7/30/2019 Distributed Shared Memory for Advanced Os
7/21
Central-Server Algorithm
A central Server maintains all the shared data.
It updates the data on write requests by clients and returnsacknowledgement messages.
Duplicate write requests can be detected by
their sequence number. A failure conditions after several Retransmission
without a response.
Advantages
Simple to implementDisadvantage
Central Server can become a bottleneck
Multicasting data access requests is undesirable as it does not reduce
load at the servers.
7/30/2019 Distributed Shared Memory for Advanced Os
8/21
Migration Algorithm
Data in the migration algorithm is shipped to the Location of the dataaccess request.
This algorithm allows only one node to access
a shared data at time.
The whole page or block containing the data item
migrates instead of an individual item requested.
It takes the advantage of locality of reference.
To reduce thrashing the mirage system uses a tunable parameter thatdetermines the duration for which a node can possess a shared data item.
It integrate the DSM with the virtual memory provided by OS running atindividual nodes.
To locate a data block, the algorithm makes use of server that keeps trackof the location of page.
7/30/2019 Distributed Shared Memory for Advanced Os
9/21
Read-Replication Algorithm
This algorithm replicates data blocks and allows multiple nodes to haveaccess or one node to have read-write access.
The write operations is expensive.
All the copies of a shared block at various nodes
will either have to be invalidated or updated with thecurrent value to maintain the consistency of the
shared data block.
DSM must keep track of the location of all the copies of data blocks.
In the IVYsystem, the owner node of a data block keeps track of all thenodes that have a copy of the data block where as in the PLUS system, adistributed Linked-list is used for this purpose.
This algorithm has the potential to reduce the average cost of readoperations when the ratio of reads to writes is large.
7/30/2019 Distributed Shared Memory for Advanced Os
10/21
Full-Replication Algorithm
This algorithm is an extension of the read-replication algorithm. It allows multiple nodes to have both read and write
access to shared data blocks.
As many nodes can write shared data concurrently,
the access to shared data must be controlled to maintain
its consistency.
consistency is maintain using gap-free sequencer. In this scheme, all nodeswishing to modify shared data will send the modifications to a sequencerassign a sequence number and multicast the modification with the sequence
number to all the nodes that have a copy of the shared data item. Each node processes the modification requests in the sequence number order.
A gap between the sequence number of a modification request and theexpected sequence number at a node indicates that one or more modificationshave been missed. This can be resolved by means of retransmission of the
modification.
7/30/2019 Distributed Shared Memory for Advanced Os
11/21
Memory Coherence
A memory is coherent if the value returned by a read operation is always thevalue that the programmer expected.
There are two measures namely
1. Coherence 2. Consistency
There are several forms of memory coherenceSequential Consistency:
If the result of any execution of the operations of all the processors is thesame as if they were executed in the sequential order.
General Consistency:
If all the copies of a memory location eventually contain the same datawhen all the writes issued by every processor have completed.
Processor Consistency:
Write issued by the processor are observed in the same order in which theywere issued. Two simultaneous reads of the same location from differentprocessors may yield different results
7/30/2019 Distributed Shared Memory for Advanced Os
12/21
Memory CoherenceWeak Consistency:
Before a Synchronization access can be performed, all previous regular data
accesses must be completed.
Before a regular data access can be performed, all previous synchronization
accesses must be completed.
Release Consistency:
Synchronization accesses must only be processor consistent with respect to
each other.
Synchronization operations are broken down into acquire and release. All pending acquires(e.g.: lock operation) must be done before a regular access
is done and all regular accesses must be done before a release(e.g.: unlock
operation) is done.
7/30/2019 Distributed Shared Memory for Advanced Os
13/21
Coherence Protocols
To provide concurrent access, DSM systems make use of data replication,where copies of data are maintained at all the nodes accessing the data.
Two basic protocols to maintain coherence in replicas are the write-invalidate
protocol and write-update protocol.
Write-Invalidate Protocol:
A write to a shared data causes the invalidation of all copies except one before
the write can proceed.
It is suitable for applications where several updates occur between reads
Disadvantage:
Invalidations are sent to all the nodes that have copies, irrespective of whether
they will use this data or not.
Write-Update Protocol:
A write to a shared data causes all copies of that data to be updated
7/30/2019 Distributed Shared Memory for Advanced Os
14/21
Coherence ProtocolsDisadvantage: It is difficult to implement, as a new value has to be sent instead of
invalidation messages.
It generates network traffic.
Cache coherence in the PLUS System:
A memory coherence manager running at each node is responsible for
maintaining the consistency.
Read Operation:
On a read fault, if the address indicates local memory, the local memory is
read. Otherwise, the local MCM sends a read request to its counterpart at thespecified remote node. The data returned by the remote MCM is passed back
to the requesting processor.
Write Operation:
Writes are always performed first on the master copy and are then propagated
to the copies linked by the copy-List.
7/30/2019 Distributed Shared Memory for Advanced Os
15/21
Coherence ProtocolsUnifying Synchronization and data transfer in clouds
Reading and writing of shared data by processes is invariably controlled
by a synchronization method.
In DSM systems using data replication and write-invalidate protocol, the
reader-writer problems can be implemented using locks as follows:
(* writer process*) (*reader process*)
Loop Loop
wait(empty); wait(full);
writelock(buffer); readlock(buffer);
update buffer; read buffer;
unlock (buffer); unlock (buffer);
signal(full); signal(empty);
Endloop; Endloop;
7/30/2019 Distributed Shared Memory for Advanced Os
16/21
Coherence ProtocolsType-Specific Memory Coherence in the Munin System: Following are the type-specific coherence mechanisms in Munin
Write-once objects:
These objects are replicated on demand and are accessed locally at each site.
Private objects:
These objects are accessed by single threads even though they are accessible to
all the threads of a process. It is not managed by the memory coherence system.
Write-many objects:
These objects are frequently modified by multiple threads between
synchronization points. Whenever a node updates a replicated data objects ,theupdates will be buffered.
Result objects:
These objects are not read until all parts of them are updated. Munin efficiently
maintains these objects through the delayed update mechanism.
7/30/2019 Distributed Shared Memory for Advanced Os
17/21
Coherence ProtocolsSynchronization objects: Objects such as distributed locks can be employed to give threads
exclusive access to data objects.
A lock operation by a thread on the local proxy object causes the local lockserver to interact with the other lock servers to acquire the global lockassociated with the local proxy.
Migratory objects:
These objects are accessed in phases, where each phase corresponds to aseries of accesses by a single thread. Objects in critical section fall under thisclass.
Producer-Consumer objects:
These objects are typically written by one thread and read by a fixed set ofother threads.
Munin handles this type of objects by moving the objects to the site where it
will be accessed in advance. This is referred to as eager object movement.
7/30/2019 Distributed Shared Memory for Advanced Os
18/21
Coherence ProtocolsRead-mostly objects:
These objects are read far more frequently than they are written.
General Read-write objects:
These objects do not exhibit particular pattern of access behavior.
Munin makes use of the Berkeley ownership protocol, which supports strictconsistency.
An object at a node can be in one of the following states:
Invalid:The object does not contain useful data.
Unowned: The object contains valid data. Other nodes may have copies of the
object. The object cannot be updated without first acquiring ownership.Owned exclusively:The object contains valid data, but it cannot be updated
before invalidating other copies.
Two types of read operations, read-shared and read-for-ownership in this
protocol.
7/30/2019 Distributed Shared Memory for Advanced Os
19/21
Design Issues
The two important issues to be considered in the design of a DSM systemare as follows:
Granularity
Page Replacement.
Granularity:
It refers to the size of the shared memory unit.
By integrating DSM with the underlying memory management system, aDSM system can take the advantage of the built-in protection mechanismto detect inherent memory references.
Larger the page size ,the greater the chance for contention to access a pageby many processes.
False sharing of a page occurs when two different data items, not sharedbut accessed by two different processes, are allocated to a single page.
7/30/2019 Distributed Shared Memory for Advanced Os
20/21
Design IssuesPage Replacement:
A memory management system has to address the issue of page replacement
because the size of physical memory is limited.
In DSM systems the data movement cannot be directly supported by
traditional methods such as Least Recently Used(LRU).
Data may be accessed in different modes such as shared,.. private, read-only,
writable, etc
Once a page is selected for replacement, the DSM system must ensure that
the page is not lost forever. Some systems make use of reserved memory, where each node is
responsible for certain portions of the global virtual space and reserves
memory space for those portions
7/30/2019 Distributed Shared Memory for Advanced Os
21/21
Thank You