Distributed UNIT 3
Distributed UNIT 3
UNIT III
Introduction, Design and implementation of DSM system, Granularity
and Consistency Model, Advantages of DSM, Clock Synchronization,
Event Ordering, Mutual exclusion, Deadlock, Election Algorithms.
*****************
1. What is DSM (Distributed Shared Memory)? Explain Design and
implementation of DSM System?
Introduction:
In computer science, distributed shared memory (DSM) is a form
of memory architecture where physically separated memories can be
addressed as one logically shared address space. Here, the term
"shared" does not mean that there is a single centralized memory; but
that the address space is "shared" (same physical address on two
processors refers to the same location in memory). Distributed global
address space (DGAS), is a similar term for a wide class of software and
hardware implementations, in which each node of a cluster has access
to shared memory in addition to each node's non-shared private
memory.
Coarse-grained Parallelism:
In coarse-grained parallelism, a program is split into large tasks.
Due to this, a large amount of computation takes place in processors.
This might result in load imbalance, wherein certain tasks process bulk
of the data while others might be idle. Further, coarse-grained
parallelism fails to exploit the parallelism in the program as most of the
computation is performed sequentially on a processor. The advantage of
this type of parallelism is low communication and synchronization
overhead.
Medium-grained Parallelism
Medium-grained parallelism is used relatively to fine-grained and
coarse-grained parallelism. Medium-grained parallelism is a compromise
between fine-grained and coarse-grained parallelism, where we have
task size and communication time greater than fine-grained parallelism
and lower than coarse-grained parallelism. Most general-purpose
parallel computers fall in this category
Levels of Parallelism:
Granularity is closely tied to the level of processing. A program
can be broken down into 4 levels of parallelism -
Ø Instruction level.
Ø Loop level
Ø Sub-routine level and
Ø Program-level
The highest amount of parallelism is achieved at instruction level,
followed by loop-level parallelism. At instruction and loop level, fine-
grained parallelism is achieved. Typical grain size at instruction-level is
20 instructions, while the grain-size at loop-level is 500 instructions.
At the sub-routine (or procedure) level the grain size is typically a
few thousand instructions. Medium-grained parallelism is achieved at
sub-routine level.
At program-level, parallel execution of programs takes place.
Granularity can be in the range of tens of thousands of instructions.
Coarse-grained parallelism is used at this level.
Consistency models:
Consistency models are used in distributed systems like
distributed shared memory systems or distributed data stores (such as
file systems. The system is said to support a given model if operations
on memory follow specific rules. The data consistency model specifies a
contract between programmer and system, wherein the system
guarantees that if the programmer follows the rules, memory will be
consistent and the results of memory operations will be predictable.
Types:
There are two methods to define and categorize consistency
models; issue and view.
Issue: Issue method describes the restrictions that define how a
process can issue operations.
View: View method which defines the order of operations visible to
processes.
Strict Consistency:
Strict consistency is the strongest consistency model. Under this
model, a write to a variable by any processor needs to be seen
instantaneously by all processors. The Strict model diagram and non-
Strict model diagrams describe the time constraint – instantaneous
Sequential Consistency
The sequential consistency model is a weaker memory model than
strict consistency. A write to a variable does not have to be seen
instantaneously; however, writes to variables by different processors
have to be seen in the same order by all processors.
Causal Consistency
Causal consistency is a weakening model of sequential consistency
by categorizing events into those causally related and those that are
not. It defines those only write operations that are causally related need
to be seen in the same order by all processes.
Processor Consistency
In order for consistency in data to be maintained and to attain
scalable processor systems where every processor has its own memory,
the Processor consistency model was derived. All processors need to be
consistent in the order in which they see writes done by one processor
and in the way they see writes by different processors to the same
location (coherence is maintained).
Cache Consistency
Cache consistency requires that all write operations to the same
memory location are performed in some sequential order. Cache
consistency is weaker than process consistency and incomparable with
PRAM consistency.
Slow Consistency
In slow consistency, if a process reads a value previously written
to a memory location, it cannot subsequently read any earlier value
from that location. Writes performed by a process are immediately
visible to that process. Slow consistency is a weaker model than PRAM
and cache consistency.
Introduction:
The concept of time is fundamental to our way of thinking. It is
derived from the more basic concept of the order in which events occur.
We say that something happened at 3:15 if it occurred after our clock
read 3:15 and before it read 3:16. The concept of the temporal ordering
of events pervades our thinking about systems.
For example, in an airline reservation system we specify that a
request for a reservation should be granted if it is made before the flight
is filled. However, we will see that this concept must be carefully
reexamined when considering events in a distributed system.
A distributed system consists of a collection of distinct processes
which are spatially separated, and which communicate with one another
by exchanging messages. A network of interconnected computers, such
as the ARPA net, is a distributed system. A single computer can also be
viewed as a distributed system in which the central control unit, the
memory units, and the input-output channels are separate processes. A
system is distributed if the message transmission delay is not negligible
compared to the time between events in a single process. We will
concern ourselves primarily with systems of spatially separated
computers. However, many of our remarks will apply more generally. In
particular, a multiprocessing system on a single computer involves
problems similar to those of a distributed system because of the
unpredictable order in which certain events can occur.
The Partial Ordering Most people would probably say that an event
a happened before an event b if a happened at an earlier time than b.
They might justify this definition in terms of physical theories of time.
However, if a system is to meet a specification correctly, then that
specification must be given in terms of events observable within the
system. If the specification is in terms of physical time, then the system
must contain real clocks. Even if it does contain real clocks, there is still
the problem that such clocks are not perfectly accurate and do not keep
precise physical time. We will therefore define the "happened before"
relation without using physical clocks.
Logical Clocks:
Let’s again consider cases that involve assigning sequence
numbers (“timestamps”) to events upon which all cooperating processes
can agree. What matters in these cases is not the time of day at which
the event occurred but that all processes can agree on the order in
which related events occur. Our interest is in getting event sequence
numbers that make sense system-wide. These clocks are called logical
clocks.
If we can do this across all events in the system, we have
something called total ordering: every event is assigned a unique
timestamp (number), every such timestamp is unique.
However, we don’t always need total ordering. If processes do not
interact then we don’t care when their events occur. If we only care
about assigning timestamps to related (causal) events then we have
something known as partial ordering.
Centralized Systems
Mutual exclusion via:
Centralized Algorithm:
Ø Mimic single processor system
Ø One process elected as Coordinator
ü Request resource
ü Wait for response
ü Receive grant
ü Access resource
ü Release resource
Benefits:
Ø Fair.
ü All requests processed in order
Ø Easy to implement, understand, verify.
Problems:
Ø Process cannot distinguish being blocked from a dead Coordinator.
Ø Centralized server can be a bottleneck.
Wireless Environments:
Ø Unreliable, and processes may move
• Network topology constantly changing
Ø Algorithm:
ü Any node starts by sending out an ELECTION message to
neighbors
ü When a node receives an ELECTION message for the first
time, it forwards to neighbors, and designates the sender as
its parent
ü It then waits for responses from its neighbors
• Responses may carry resource information
ü When a node receives an ELECTION message for the second
time, it just OKs it
*****************
*****************