0% found this document useful (0 votes)
6 views10 pages

DS Notes Unit 3

Distributed Shared Memory (DSM) allows multiple computers to share memory, simplifying data access and communication in distributed systems. It offers advantages such as easier portability and better performance but has disadvantages like slower data access and consistency challenges. The document also discusses DSM architecture, design issues, consistency models, and process migration, highlighting the complexities and requirements for effective implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views10 pages

DS Notes Unit 3

Distributed Shared Memory (DSM) allows multiple computers to share memory, simplifying data access and communication in distributed systems. It offers advantages such as easier portability and better performance but has disadvantages like slower data access and consistency challenges. The document also discusses DSM architecture, design issues, consistency models, and process migration, highlighting the complexities and requirements for effective implementation.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

UNIT-3

DISTRIBUTED SHARED MEMORY


Definition-Distributed Shared Memory (DSM) is a concept in distributed systems
where memory is shared across multiple computers or nodes, creating an abstraction
that allows these computers to access and manipulate shared data as if they were
accessing a single physical [Link] allows processes running on different
machines in a distributed environment to communicate and share data more easily.

Advantages of Distributed shared memory

 Simpler abstraction: Programmer need not concern about data movement,


as the address space is the same it is easier to implement than RPC.
 Easier portability: The access protocols used in DSM allow for a natural
transition from sequential to distributed systems. DSM programs are portable as
they use a common programming interface.
 Locality of data: Data moved in large blocks i.e. data near to the current
memory location that is being fetched, may be needed future so it will be also
fetched.
 On-demand data movement: It provided by DSM will eliminate the data
exchange phase.
 Larger memory space: It provides large virtual memory space, the total
memory size is the sum of the memory size of all the nodes, paging activities are
reduced.
 Better Performance: DSM improve performance and efficiency by
speeding up access to data.
 Flexible communication environment: They can join and leave DSM
system without affecting the others as there is no need for sender and receiver to
existing,
 Process migration simplified: They all share the address space so one
process can easily be moved to a different machine.

Disadvantages of Distributed shared memory

 Accessibility: The data access is slow in DSM as compare to non-distributed.


 Consistency: When programming is done in DSM systems, programmers
need to maintain consistency.
 Message passing: DSM use asynchronous message passing and is not
efficient as per other message passing implementation.
 Data redundancy: DSM allows simultaneous access to data, consistency
and data redundancy is common disadvantage.
 Lower Performance: CPU gets slowed down, even cache memory does not
aid the situation.
Architecture of Distributed Shared Memory(DSM)
 Implements the distributed systems shared memory model in a distributed
system, that hasn’t any physically shared memory. Shared model provides a
virtual address area shared between any or all nodes.
 DSM memo, model provides a virtual address area shared between all nodes.
systems move information to the placement of access. Information moves
between main memory and secondary memory (within a node) and between
main recollections of various nodes.

Fig.: Distributed shared memory


 The initial owner is that the node that created the object. The mapping
manager maps shared memory address to physical memory (local or remote).
 The components of Architecture of Distributed Shared Memory :
[Link]: Each node in the distributed system consists of one or more CPUs and a
memory unit. These nodes are connected via a high-speed communication network.
[Link] Mapping Manager Unit: The memory mapping manager routine in
each node is responsible for mapping the local memory onto the shared memory
space. This involves dividing the shared memory space into blocks and managing
the mapping of these blocks to the physical memory of the node.
[Link] Network Unit: This unit facilitates communication between
nodes. When a process accesses data in the shared address space, the memory
mapping manager maps the shared memory address to physical memory. The
communication network unit handles the communication of data between nodes,
ensuring that data can be accessed remotely when necessary.
DESIGN AND IMPlEMENTATION ISSUES OF DSM-

 Granularity
 Structure of shared memory space
 Memory coherence and access synchronization
 Data location and access
 Replacement strategy
 Thrashing
 Heterogeneity

1. Granularity: Granularity refers to the block size of a DSM system. Granularity


refers to the unit of sharing and the unit of data moving across the network when a
network block shortcoming then we can utilize the estimation of the block size as
words/phrases. The block size might be different for the various networks.
[Link] of shared memory space: Structure refers to the design of the shared
data in the memory. The structure of the shared memory space of a DSM system is
regularly dependent on the sort of applications that the DSM system is intended to
support.
3. Memory coherence and access synchronization: In the DSM system the shared
data things ought to be accessible by different nodes simultaneously in the network.
The fundamental issue in this system is data irregularity. The data irregularity might
be raised by the synchronous access. To solve this problem in the DSM system we
need to utilize some synchronization primitives, semaphores, event count, and so on.
4. Data location and access: To share the data in the DSM system it ought to be
possible to locate and retrieve the data as accessed by clients or processors.
Therefore the DSM system must implement some form of data block finding system
to serve network data to meet the requirement of the memory coherence semantics
being utilized.
5. Replacement strategy: In the local memory of the node is full, a cache miss at
the node implies not just a get of the gotten to information block from a remote node
but also a replacement. A data block of the local memory should be replaced by the
new data block. Accordingly, a position substitution methodology is additionally
vital in the design of a DSM system.
6. Thrashing: In a DSM system data blocks move between nodes on demand. In
this way on the off chance that 2 nodes compete for write access to the single data
item. The data relating data block might be moved to back and forth at such a high
rate that no genuine work can get gone. The DSM system should utilize an approach
to keep away from a situation generally known as thrashing.
7. Heterogeneity: The DSM system worked for homogeneous systems and need not
address the heterogeneity issue. In any case, assuming the underlined system
environment is heterogeneous, the DSM system should be designed to deal with
heterogeneous, so it works appropriately with machines having different
architectures.
What is Consistency?
Consistency is a fundamental property of distributed systems that ensures that all
replicas of a shared data store have the same value. In a distributed system, data is
typically replicated across multiple nodes to improve availability and fault tolerance.
However, maintaining consistency across all replicas can be challenging, especially
in the presence of concurrent updates and network delays.

consistency model - Consistency Model in Distributed Shared Memory (DSM) refers


to a set of rules that define how changes to data in memory are reflected across
different nodes in a distributed system. These rules ensure that all nodes have a
consistent view of the shared memory.

Types of consistency models :


1. Sequential consistency model
2. Release Consistency Model
3. Strict Consistency Model
4. Causal Consistency Model
5. Weak Consistency Model
6. Eventual Consistency Model

(1) Sequential consistency model- Sequential Consistency is a memory model used


in distributed shared memory (DSM) systems to ensure that the execution of
operations (reads and writes) appear to occur in a specific, well-defined order.

Key Characteristics of the Sequential Consistency Model

 Program Order Preservation: The memory operations from any individual


process occur in the order in which they were issued by that process. For
instance, if Process A issues a write followed by a read, these two operations
will occur in that order from the perspective of Process A.
 Single Global Order: All processes must agree on the order of all memory
operations. If Process A sees an update by Process B before an update by
Process C, then Process B must see the same order.
 Non-Real-Time: The model does not require that memory operations are
synchronized with real-time events. Instead, they only need to appear in a
logical sequence.

Fig.: Sequential consistency


execution order between A1, B1 and C1 is preserved, that is, A1 runs before B1, and
B1 before C1. The same for A2 and B2. But, as execution order between processors is
undefined, B2 might run before or after C1 (B2 might physically run before C1, but
the effect of B2 might be seen after that of C1, which is the same as "B2 run after
C1").

Example:

Let’s consider two processes, P1 and P2, operating on a shared variable X.

P1 executes:

o Write(X, 1)
o Write(X, 2)

P2 executes:

o Read(X)

In a sequentially consistent system, the execution might produce results that appear as
if operations of both processes happened sequentially in some global order. Some
possible sequences are:

 P1: Write(X, 1) → Write(X, 2) → P2: Read(X) (result: 2)


 P2: Read(X) → P1: Write(X, 1) → Write(X, 2) (result: 0 if X was initialized
to 0)

The key point is that P2 sees changes in X as if all operations happened in a global
order, even though it might not be the actual time order.

Advantages:

1. Simplicity: It provides a straightforward and easy-to-understand model for


reasoning about the behavior of concurrent processes.
2. Predictability: The operations appear in a global sequence, making debugging
and verification easier.
3. Program Order Preserved: Each process sees its own operations in the exact
order they were issued, simplifying the writing of concurrent programs.

Applications:

1. Distributed Databases: Sequential consistency ensures that transactions


across distributed nodes behave in a predictable order, preserving data
consistency.
2. Shared Memory Multiprocessor Systems: In systems where multiple
processors access a shared memory, sequential consistency can ensure that all
processors see memory updates in a consistent way.
3. Parallel Programming Environments: High-performance computing
systems often rely on the sequential consistency model to simplify the
development of parallel programs.
4. Cloud Storage Systems: Distributed storage systems may implement
sequential consistency to ensure that clients accessing shared data see a
consistent view of updates.

(2) Release Consistency Model- The Release Consistency (RC) model is a


consistency model for Distributed Shared Memory (DSM) systems. In RC, updates to
shared variables are propagated across the system only at well-defined
synchronization points, typically when a "release" operation is performed. It ensures
that shared memory is updated after synchronization.

Key Characteristics of Release Consistency:

1. Synchronization-based Updates: The key feature of RC is that shared memory


updates are not propagated immediately but are delayed until specific synchronization
points (acquire/release operations) are reached.
2. Two Types of Synchronization Operations:

1. Acquire: This operation is performed before entering a critical section


or accessing shared data. It ensures that the latest version of the shared
data is retrieved before any operation on shared memory.
2. Release: This operation is performed after exiting a critical section or
when the thread has finished modifying shared data. This is where
updates to shared memory are propagated to other processors.

[Link] Global Order of Events: Unlike Sequential Consistency, there is no global


order for memory updates across all processes. The RC model focuses on ensuring
consistency only at synchronization points.

4. Lazy Propagation: Instead of immediately propagating all memory changes ,


updates are lazily propagated to other processes only when necessary, improving
performance.

Example of Release Consistency:

Consider two processors (P1 and P2) sharing a variable X in a DSM system:

Step 1 (P1 Acquires Lock):


P1 acquires a lock on X to start writing. No changes are propagated to P2 yet.

Step 2 (P1 Updates X):


P1 updates X = 10. This change is not immediately visible to P2.

Step 3 (P1 Releases Lock):


P1 releases the lock. This "release" ensures that the new value of X (i.e., X =
10) is propagated to the shared memory.

Step 4 (P2 Acquires Lock):


P2 acquires the lock and now reads the value of X. Due to the synchronization
point at the release operation by P1, P2 sees the updated value X = 10.
Here, the synchronization ensures that X's update is made visible to other processors
only after the release operation.

Advantages of Release Consistency Model:

Improved Performance: By delaying memory propagation until synchronization


points, RC reduces the amount of data communicated between processes, leading to
faster execution in many parallel applications.

Better Scalability: Since updates to shared memory are delayed and not immediately
propagated, the system can handle larger-scale distributed applications efficiently.

Reduced Communication Overhead: Unlike stricter models, RC avoids


unnecessary data propagation, especially in cases where data consistency is not
immediately required, reducing communication traffic.

Flexibility for Programmers: RC allows programmers to control when shared


memory updates occur, offering flexibility in designing efficient parallel applications.

Applications of Release Consistency Model:

Parallel Computing: RC is widely used in parallel computing environments, where


multiple processors work on shared data but do not need immediate consistency. This
allows for better performance in scientific computations and simulations.

Distributed Shared Memory (DSM) Systems: The RC model is suitable for DSM
systems in distributed environments, where shared memory is emulated across
different machines.

Multithreaded Programming: In programs with multiple threads, especially those


using locks or other synchronization mechanisms, RC helps maintain consistency
without affecting the overall performance.

Large-Scale Cloud Systems: RC is useful in cloud environments where large-scale


distributed applications require efficient memory consistency but can tolerate slight
delays in shared memory propagation.

Process Migration

Process migration is the relocation of a process from its current location (the source
node) to another node (the destination node). The flow of execution of a migrating
process is illustrated in Figure .
Fig.: Process Migration in Distributed System

Types of process migration

1. preemptive process migration

2. non-preemptive process migration

1. preemptive process migration- In preemptive migration, a process is moved while


it is still executing. This is more complex because the current state of the process,
including memory and execution state, must be transferred.

2. non-preemptive process migration- In non-preemptive migration, a process is


migrated only when it voluntarily gives up control, such as during blocking system
calls or when it explicitly requests to be migrated. This is easier to implement since it
happens during a natural pause in execution, but it offers less flexibility compared to
preemptive migration.

Process migration involves the following major steps:


1. Selection of a process that should be migrated.
2. Selection of the destination node to which the selected process should be Migrated.
3. Actual transfer of the selected process to the destination node.

Desirable Features of a Good Process Migration Mechanism

1. Transparency
2. Minimal Interference
3. Minimal Residual Dependencies
4. Efficiency
5. Robustness
6. Communication between Co processes of a Job

1. Transparency- The migration should be transparent to the user and the application.
The process should continue execution as if nothing has changed, and there should be
no need for modifications in the application code to support migration.
2. Minimal Interference- Migration of a process should cause minimal interference
to the progress of the process involved and to the system as a whole. One method to
achieve this is by minimizing the freezing time of the process being migrated.
Freezing time is defined as the time period for which the execution of the process is
stopped for transferring its information to the destination node.

3. Minimal Residual Dependencies - After migration, the migrated process should


have minimal or no residual dependencies on the source node (where it was initially
executing). This involves transferring the entire process state, including open file
descriptors, memory, and communication channels.

4. Efficiency - The migration mechanism should be resource-efficient in terms of


CPU, memory, and network bandwidth usage. The amount of data transferred during
the migration, including process state and memory, should be minimized.

[Link] - The migration mechanism should be robust, meaning it can handle


failures during the migration process. This includes the ability to recover gracefully
from network failures, resource unavailability, or other unexpected events during
migration.

6. Communication between Co processes of a Job - In distributed systems,


processes often communicate with each other, especially when they are part of a
single job or task. The migration mechanism should preserve and maintain the
communication channels between co-processes even after one or more processes are
migrated.

Process Migration Mechanisms

Migration of a process is a complex activity that involves proper handling of several


sub-activities in order to meet the requirements of a good process migration
mechanism listed above. The four major sub activities involved in process migration
are as follows:

1. Freezing the process on its source node and restarting it on its destination node.

2. Transferring the process's address space from its source node to its destination node.

3. Forwarding messages meant for the migrant process .

4. Handling communication between cooperating processes that have been separated


(placed on different nodes) as a result of process migration.

Prepared By Devika Sahu

You might also like