Title: Why do we need models?
1Why do we need models?
There are many dimensions of variability in
distributed systems. Examples interprocess
communication mechanisms, failure classes,
security mechanisms etc. Models are simple
abstractions that help understand the variability
-- abstractions that preserve the essential
features, but hide the implementation details
from observers who view the system at a higher
level.
2A message passing model
- System is a graph G (V, E).
- V set of nodes (sequential processes)
- E set of edges (links or channels)
(bi/unidirectional) - Four types of actions by a process
- - Internal action
- - Communication action
- - Input action
- - Output action
3A reliable FIFO channel
- Axiom 1. Message m sent ? message m received
- Axiom 2. Message propagation delay is arbitrary
but finite. - Axiom 3. m1 sent before m2 ? m1 received before
m2.
P
Q
4Life of a process
- When a message m is received
- 1. Evaluate a predicate with m and the local
variables - 2. if predicate true then
- - update internal variables
- -send k (k0) messages
- else skip do nothing
- end if
5Synchrony vs. Asynchrony
- Send receive can be blocking or non-blocking
- Postal communication is asynchronous
- Telephone communication is synchronous
- Synchronous communication or not?
- RPC,
- Email
6Shared memory model
- Here is an implementation of a channel of
capacity (max-1) - Sender P writes into the circular buffer and
increments the pointer (when p ? q-1 mod max) - Receiver Q reads from the circular buffer and
increments the pointer (when q ? p)
p
q
7Variations of shared memory models
State reading model. Each process can read the
states of its neighbors
1
0
2
3
Link register model. Each process can read from
and write ts adjacent buffers
0
2
1
3
8Modeling wireless networks
- Communication via broadcasting
- Limited range
- Dynamic topology
- Collision of broadcasts
- (handled by CSMA/CA protocol)
- Low power
RTS
RTS
CTS
9Weak vs. Strong Models
- One object (or operation) of a strong model
More than one objects (or operations) of a weaker
model. - Often, weaker models are synonymous with fewer
restrictions. - One can add layers to create a stronger model
from weaker one).
- Examples
- HLL model is stronger than assembly language
model. - Asynchronous is weaker than synchronous.
- Bounded delay is stronger than unbounded delay
(channel)
10Model transformation
- Stronger models
- - simplify reasoning, but
- - needs extra work to implement
- Weaker models
- - are easier to implement.
- - Have a closer relationship with the real
world
- Can model X be implemented using model Y is an
interesting question in computer science. - Sample problems
- Non-FIFO channel to FIFO channel
- Message passing to shared memory
- Atomic broadcast to non-atomic broadcast
11A resequencing protocol
- sender process P receiver process Q
- var i integer initially 0 var k integer
initially 0 - buffer buffer0..8 of msg
- initially ? k buffer k empty
- repeat repeat
- send mi,i to Q STORE receive mi,i
from P - i i1 store mi into
bufferi - forever DELIVER while bufferk ? empty
do - begin
- deliver content of buffer k
- buffer k empty? k k1
- end
- forever
12Observations
- (a) Needs Unbounded sequence numbers and
- (b) Needs Unbounded number of buffer slots
- This is bad.
- Now solve the same problem on a model where
- (a) The propagation delay has a known upper bound
of T. - (b) The messages are sent out _at_ r per unit time.
- (c) The messages are received at a rate faster
than r. - The buffer requirement drops to r.T. Synchrony
pays. - Question. How can we solve the problem using
bounded buffer space when the propagation delay
is arbitrarily large?
13Non-atomic to atomic broadcast
- We now include crash failure as a part of our
model. First realize what the difficulty is with
a naïve approach - process i is the sender
- for j 1 to N-1 (j ? i)
- send message m to neighborj
- What if the sender crashes at the middle?
- Suggest an algorithm for atomic broadcast.
14Other classifications
- Reactive vs Transformational systems
- A reactive system never sleeps (like a server,
or a token ring) - A transformational (or non-reactive systems)
reaches a fixed point after which no further
change occurs in the system - Named vs Anonymous systems
- In named systems, process id is a part of the
algorithm. - In anonymous systems, it is not so. All are
equal. - (-) Symmetry breaking is often a challenge.
- () Saves log N bits. Easy to switch one process
by another with no side effect)
15Model and complexity
- Many measures
- Space complexity
- Time complexity
- Message complexity
- Bit complexity
- Round complexity
Consider broadcasting in an n-cube (n3)
source
16Broadcasting using messages
Each process j has a variable xj initially
undefined
- Process 0 sends m to neighbors
- Process i gt 0
- repeat
- receive message m m contains the value
- if m is received for the first time
- then xi m.value send xi to each neighbor
j gt I - else discard m
- end if
- forever
- What is the (1) message complexity
- (2) space complexity per process?
17Broadcasting using shared memory
Each process j has a variable xj initially
undefined
- Process 0 x0 v
- Process i gt 0
- repeat
- if ? a neighbor j lt i xi ? xj then xi
xj - this is a step
- else skip
- end if
- forever
- What is the time complexity?
- How many steps are needed?
- Can be arbitrarily large!
18Broadcasting using shared memory
Each process j has a variable xj initially
undefined
- Now, use large atomicity, where
- in one step, a process can read
- the states of ALL its neighbors.
- What is the time complexity?
- How many steps are needed?
- The time complexity is now O(n2)
19Complexity in rounds
Each process j has a variable xj initially
undefined
- Rounds are truly defined for
- synchronous systems. An
- asynchronous round consists
- of a number of steps where
- every process (including the
- slowest one) takes at least
- one step.
- How many rounds do you need
- to complete the broadcast?
20Exercises
- Consider an anonymous distributed system
consisting of N processes. The topology is a
completely connected network, and the links are
bidirectional. Propose an algorithm using which
processes can acquire unique identifiers. (Hint
use coin flipping, and organize the computation
in rounds).
21Exercises
- Alice and Bob enter into an agreement whenever
one falls sick, (s)he will call the other person.
Since making the agreement, no one called the
other person, so both concluded that they are in
good health. Assume that the clocks are
synchronized, communication links are perfect,
and a telephone call requires zero time to reach.
What kind of interprocess communication model is
this?