Chapter 2
Chapter 2
Contents
Parallel computing.
Concurrency.
Parallelism levels; parallel computer architecture.
Distributed systems.
Processes, threads, events, and communication channels.
Global state of a process group.
Logical clocks.
Runs and cuts.
The snapshot protocol.
Atomic actions.
Consensus algorithms.
Modeling concurrency with Petri Nets.
Client-server paradigm.
Cloud Computing: Theory and Practice.
Dan C. Marinescu Chapter 2 2
The path to cloud computing
Cloud computing is based on ideas and the experience
accumulated in many years of research in parallel and distributed
systems.
Cloud applications are based on the client-server paradigm with a relatively
simple software, a thin-client, running on the user's machine, while the
computations are carried out on the cloud.
Concurrency is important; many cloud applications are data-intensive and
use a number of instances which run concurrently.
Checkpoint-restart procedures are used as many cloud computations run for
extended periods of time on multiple servers. Checkpoints are taken
periodically in anticipation of the need to restart a process when one or
more systems fail.
Communication is at the heart of cloud computing. Communication
protocols which support coordination of distributed processes travel through
noisy and unreliable communication channels which may lose messages or
deliver duplicate, distorted, or out of order messages.
Cloud Computing: Theory and Practice.
Dan C. Marinescu Chapter 2 3
Parallel computing
Parallel hardware and software systems allow us to:
Solve problems demanding resources not available on a single system.
Reduce the time required to obtain a solution.
The speed-up S measures the effectiveness of parallelization:
S(N) = T(1) / T(N)
T(1) the execution time of the sequential computation.
T(N) the execution time when N parallel computations are executed.
Amdahl's Law: if α is the fraction of running time a sequential program
spends on non-parallelizable segments of the computation then
S = 1/ α
Gustafson's Law: the scaled speed-up with N parallel processes
S(N) = N – α( N-1)
receive event.
1 2 5
e e 3
e e
4
e
(a)All events in process p1 are local; the p 2
2 2 2 2 2
p 3
(c)
(c)Three
processes interact by means of
communication events.
Cloud Computing: Theory and Practice.
Dan C. Marinescu Chapter 2 15
Global state of a process group
The global states of a distributed computation with n processes form
an n-dimensional lattice.
How many paths to reach a global state exist? The more paths, the
harder is to identify the events leading to a given state. A large
number of paths increases the difficulties to debug a system.
In case of two threads the number of paths from the initial state Σ(0,0)
to the state Σ(m,n) is:
N (m,n) = (m + n) /(m!n!)
In the two dimensional case the global state Σ (m,n) can only be
reached from two states, Σ(m-1,n) and Σ(m,n-1)
(m-1,n) (m,n-1)
(m,n)
p
1
1, 0
0 ,1
p
2 1
e e 2
2
2
1 2
e 1 e 1
2,0 1,1 0, 2
p 1
p 2
1 2
e e
The lattice of the
3, 0 2 2
(a)
2 ,1 1, 2
1 2
e e
global states of two 1 1
p
1
3,1
2, 2
p
processes with the 2 1
e e 2
2
2
space-time showing
4 ,1
3, 2
2,3
e e
1
1
2
1
p
events per process.
5 ,1 3, 3
4, 2 2, 4 2 1 2
e e 2 2
1 2
e e
(b) The six possible
5, 2
4,3
3, 4
2,5 p
1
1 1
sequences of p
2
e
1
2 e
2
2
events leading to
53
4, 4
3, 5
e
1
1 e
1
2
p
the state Σ2,2 p
1
4,5 2
5, 4 1 2
e 2 e 2
5, 5
time
6,5
(a) (b)
Process coordination in the presence of errors; each message may be lost with
probability ε. If a protocol consisting of n messages exists, then the protocol
should be able to function properly with n-1 messages reaching their
destination, one of them being lost.
m 1 m 2 m
5
1 2 6 7 8 9
p 2
m 3 m 4
1 2 3 10 11
p 3
deliver
Channel/ Channel/
Process receive Process
Interface Interface
Channel
Message receiving and message delivery are two distinct operations. The
channel-process interface implements the delivery rules, e.g., FIFO delivery.
m m 3
2
p 2
m 1
p 3
Violation of causal delivery when more than two processes are involved;
message m1 is delivered to process p2 after message m1, though message m1
was sent before m3. Indeed, message m3 was sent by process p1 after
receiving m1, which in turn was sent by process p3 after sending message m1.
Cloud Computing: Theory and Practice.
Dan C. Marinescu Chapter 2 25
Runs and cuts
Run a total ordering of all the events in the global history of a
distributed computation consistent with the local history of each
participant process; a run implies a sequence of events as well as a
sequence of global states.
Cut a subset of the local history of all processes.
Frontier of the cut in the global history of n processes an n-tuple
consisting of the last event of every process included in the cut.
Cuts provide the intuition to generate global states based on an
exchange of messages between a monitor and a group of processes.
The cut represents the instance when requests to report individual
state are received by the members of the group.
p 1
m m C 1 C 2
m
5
1 2
1 2 3
e
2 e
2 e
2 e e
4
2
5
2
6
e
2
p 2
m 3 m 4
1 2 4 5
e 3 e
3
3
e
3 e 3 e
3
p 3
p 1
m
1 m 2 m
5
1 2 3
e 2 e
2 e 2 e e
4
2
5
2 e
6
2
p 2
m 3 m 4
1 2 4 5
e 3 e
3
3
e
3 e
3 e
3
p 3
The causal history of event e25 is the smallest consistent cut including e25.
2
2 2
2
2
p5 p2
2 2
2 2 2
2 2 2
22 2
2 2
2 p4 p3
2
Abort Aborted
a a a k k k z z z
Cell storage
ACTION M
Catalog
a
READ
n Outcome records
a
WRITE
g
COMMIT
e Version histories
ABORT
r
Journal storage
Storage models. Cell storage does not support all-or-nothing actions. When we
maintain the version histories it is possible to restore the original content but we
need to encapsulate the data access and provide mechanisms to implement the two
phases of an atomic all-or-nothing action. The journal storage does precisely that.
Cloud Computing: Theory and Practice.
Dan C. Marinescu Chapter 2 37
Atomicity
Before-or-after atomicity the effect of multiple actions is as if
these actions have occurred one after another, in some order.
A systematic approach to atomicity must address several delicate
questions:
How to guarantee that only one atomic action has access to a shared
resource at any given time.
How to return to the original state of the system when an atomic action
fails to complete.
How to ensure that the order of several atomic actions leads to
consistent results.
The proposal with the highest number pn < k already accepted by each acceptor.
Proposal promise: An acceptor must remember the proposal number of the highest
proposal number it has ever accepted and the highest proposal number it has ever
responded to. It can accept a proposal with pn=k if and only if it has not responded to
a prepare request with pn > k; if it has already replied to a prepare request for a
proposal with pn > k it should not reply.
Phase II.
Accept request: If the majority of acceptors respond, then the proposer chooses the
value v of the proposal as follows:
the value v of the highest proposal number selected from all the responses.
2 1 2 1 2 1
t1 t1 t1
3 3 3
p3 p3 p3
Petri Nets firing rules. (a) An unmarked net with one transition t1 with two input places,
p1 and p2 and one output place, p3. (b) The marked net, the net with places populated
by tokens; the net before firing the enabled transition t1.
(c) The marked net after firing transition t1 two tokens from place p1 and one from
place p2 are removed and transported to place p3
Cloud Computing: Theory and Practice.
Dan C. Marinescu Chapter 2 46
p4
t3
p1 p1 p2 p1 p2 p3
t1 t2 t1 t2 t3 t1 t2
(b) Symmetric confusion; transitions t1 and t3 are concurrent and, at the same
time, they are in conflict with t2. If t2 fires, then t1 and/or t3 are disabled.
(c) Asymmetric confusion; transition t1 is concurrent with t3 and it is in conflict with
t2 if t3 fires before t1.
Cloud Computing: Theory and Practice.
an C. Marinescu Chapter 2 47
t1 p2 t3 t2
p1 p3
t1 t4
p1 p4
p2 t3 p4
t2 p3 t4
p1 (b)
(a)
n
p1 p2 t3 t4
t1 t2 p3 t2 p2 t1 p4
n
n
p3 p4
n
(d)
(c)
Petri Nets
time time
Cloud Computing: Theory and Practice.
Dan C. Marinescu Chapter 2 53
request
HTTP client
Web
TCP
port
HTTP
Browser 80 server
response
request to proxy
HTTP client
Web request to server
Browser
Proxy
TCP port 80
A Web client can: (a) communicate directly with the server; (b) communicate
through a proxy; (c) use tunneling to cross the network.
Cloud Computing: Theory and Practice.
Dan C. Marinescu Chapter 2 54