Sunteți pe pagina 1din 53

Distributed Systems Concepts

Ch. 10 and 14-17


Figure 10.1
Skew between computer clocks
in a distributed system

Network
Figure 10.2
Clock synchronization using a
time server
mr

mt
p Time server,S
Figure 10.3
An example synchronization
subnet in an NTP
implementation 1

2 2

3 3 3

Note: Arrows denote synchronization control, numbers denote


strata.
Figure 10.4
Messages exchanged between
a pair of NTP peers
Server B Ti-2 Ti-1
Time

m m'

Time
Server A Ti- 3 Ti
Figure 10.5
Events occurring at three
processes
p1
a b m1

p2 Physical
c d time
m2

p3
e f
Figure 10.6
Lamport timestamps for the
events shown in Figure 10.5
1 2
p1
a b m1

3 4
p2 Physical
c d time
m2

1 5
p3
e f
Figure 10.7
Vector timestamps for the
events shown in Figure 10.5
(1,0,0) (2,0,0)
p1
a b m1

(2,1,0) (2,2,0)
Physical
p2
time
c d m2

(0,0,1) (2,2,2)
p3
e f
Figure 10.8
Detecting global properties p1 p2

object
reference
message
a. Garbage collection garbage object

p1 p2
wait-for

b. Deadlock wait-for

p1 p2
activate
c. Termination passive passive
Figure 10.9
Cuts
0 1 2 3
e1 e1 e1 e1
p1
m1 m2

p2 Physical
0 1 2 time
e2 e2 e2

Inconsistent cut
Consistent cut
Figure 10.10
Chandy and Lamport’s
‘snapshot’
Marker receiving rule for process p algorithm
i
On pi’s receipt of a marker message over channel c:
if (pi has not yet recorded its state) it
records its process state now;
records the state of c as the empty set;
turns on recording of messages arriving over other incoming channels;
else
pi records the state of c as the set of messages it has received over c
since it saved its state.
end if
Marker sending rule for process pi
After pi has recorded its state, for each outgoing channel c:
pi sends one marker message over c
(before it sends any other message over c).
Figure 10.11
Two processes and their initial
states
p1 c2 p2
c1

$1000 (none) $50 2000

account widgets account widgets


Figure 10.12
The execution of the processes
in Figure 10.11
1. Global state S 0
<$1000, 0> p1 c2 (empty) p2 <$50, 2000>

c1 (empty)

2. Global state S 1
<$900, 0> p1 c2 (Order 10, $100), M p2 <$50, 2000>

c1 (empty)

3. Global state S 2
<$900, 0> p1 c2 (Order 10, $100), M p2 <$50, 1995>
c1 (five widgets)

4. Global state S 3
<$900, 5> p1 c2 (Order 10, $100) p2 <$50, 1995>

c1 (empty)

(M = marker message)
Figure 10.13
Reachability between states in
the snapshot algorithm
actual execution e 0 ,e 1,...

Sinit recording recording Sfinal


begins ends

Ssnap
pre-snap: e '0 ,e '1 ,...e 'R-1 post-snap: e ' R,e 'R+1 ,...
Figure 10.14
Vector timestamps and variable
values for the execution of
(1,0) (2,0) Figure 10.9(4,3)
(3,0)
x1= 1 x1 = 100 x1 = 105 x1= 90
p1
m1 m2

p2 Physical
time
x2 = 100 x2 = 95 x2 = 90
(2,1) (2,2) (2,3)
Cut C 2
Cut C1
Chapter 11,12, and 13
• Are on transaction an concurrency control
that are typically covered in a data base
course.
Ch 14: Fault Tolerance
Figure 14.1
A basic architectural model for
the management of replicated
Requests and
replies data
RM
C FE RM

Clients Front ends Service

C FE Replica
RM managers
Figure 14.2
Services provided for process groups
Group
address
expansion

Group Leave
send

Multicast Group membership


communication Fail
management

Join

Process group
Figure 14.3
View-synchronous
a (allowed).
group communication
b (allowed).
p crashes p crashes
p p

q q

r r

view (p, q, r) view (q, r) view (p, q, r) view (q, r)

c (disallowed). d (disallowed).
p crashes p crashes
p p

q q

r r

view (q, r) view (p, q, r) view (q, r)


view (p, q, r)
Figure 14.4
The passive (primary-backup)
model for fault tolerance
Primary

C FE RM
RM
Backup

C FE RM
Backup
Figure 14.5
Active replication
RM

C FE RM FE C

RM
Ch.15: Distributed Multimedia
Systems
Figure 15.1
A distributed multimedia system
Video camera
and mike

Local network Local network

Wide area gateway Video Digital


server TV/radio
server
Figure 15.2
The window of scarcity for
computing and communication
resources
interactive
video

insufficient scarce
high-quality resources resources
audio

abundant
network resources
file access

remote
login
1980 1990 2000
Figure 15.3
Characteristics of typical
multimedia streams
Data rate Sample or frame
(approximate) frequency size

Telephone speech 64 kbps 8 bits 8000/sec


CD-quality sound 1.4 Mbps 16 bits 44,000/sec
Standard TV video 120 Mbps up to 640x 480 24/sec
(uncompressed) pixelsx 16 bits
Standard TV video 1.5 Mbps variable 24/sec
(MPEG-1 compressed)
HDTV video 1000–3000 Mbps up to 1920x 1080 24–60/sec
(uncompressed) pixelsx 24 bits
HDTV video 10–30 Mbps variable 24–60/sec
MPEG-2 compressed)
Figure 15.4
Typical infrastructure
components for multimedia
applications
PC/workstation PC/workstation
Window system
Camera H
A K G
Codec Codec

B L
Microphones Mixer

Network
C connections
Screen Video file system Video
D store
M
Codec

Window system

: multimedia stream
White boxes represent media processing components,
many of which are implemented in software, including:
codec: coding/decoding filter
mixer: sound-mixing component
Figure 15.5
QoS specifications for
components of the application
shown in Figure 15.4
Component Bandwidth Latency Loss rate Resources required
Camera Out: 10 frames/sec, raw video Zero
640x480x16 bits
A Codec In: 10 frames/sec, raw video Interactive Low 10 ms CPU each 100 ms;
Out: MPEG-1 stream 10 Mbytes RAM
B Mixer In: 2 44 kbps audio Interactive Very low 1 ms CPU each 100 ms;
Out: 1 44 kbps audio 1 Mbytes RAM
H Window In: various Interactive Low 5 ms CPU each 100 ms;
system Out: 50 frame/sec framebuffer 5 Mbytes RAM
K Network In/Out:MPEG-1 stream, approx. Interactive Low 1.5 Mbps, low-loss
connection 1.5 Mbps stream protocol
L Network In/Out: Audio 44 kbps Interactive Very low 44 kbps, very low-loss
connection stream protocol
Figure 15.6
The QoS manager’s task
Admission control QoS negotiation
Application components specify their QoS
requirements to QoS manager

Flow spec.
QoS manager evaluates new requirements
against the available resources.
Sufficient?
Yes No

Reserve the requested resources Negotiate reduced resource provision with application.
Agreement?
Resource contract Yes No
Allow application to proceed
Do not allow application to proceed

Application runs with resources as Application notifies QoS manager of


per resource contract increased resource requirements
Figure 15.7
Traffic shaping algorithms
(a) Leaky bucket (b) Token bucket

Token generator
Figure 15.8
The RFC 1363 Flow Spec
Protocol version
Maximum transmission unit
Token bucket rate
Bandwidth:
Token bucket size
Maximum transmission rate
Minimum delay noticed
Delay:
Maximum delay variation
Loss sensitivity
Loss: Burst loss sensitivity
Loss interval
Quality of guarantee
Figure 15.9
Filtering

Source
Targets

Highbandwidth
Mediumbandwidth
Lowbandwidth
Figure 15.10
Tiger video file server hardware
configuration Controller
low-bandwidth network

0 n+1 1 n+2 2 n+3 3 n+4 n 2n+1

Cub 0 Cub 1 Cub 2 Cub 3 Cub n


high-bandwidth

ATM switching network

Start/Stop
video distribution to clients requests from clients
Figure 15.11
Tiger schedule

2 1 block service 0
block play timeT timet

slot 0 slot 1 slot 2 slot 3 slot 4 slot 5 slot 6 slot 7


viewer 4 free free viewer 0 viewer 3 viewer 2 free viewer 1
state state state state state
16: Distributed Shared Memory
Figure 16.1
The distributed shared memory
abstraction
Distributed shared memory

DSM appears as
Process
memory in address
accessing DSM
space of process

Physical Physical Physical


memory memory memory
Figure 16.2
Mether system program - slide 1
#include "world.h"
struct shared { int a,b; };
Program Writer:
main()
{
struct shared *p;
methersetup(); /* Initialize the Mether run-time */
p = (struct shared *)METHERBASE;
/* overlay structure on METHER segment */
p->a = p->b = 0;
while(TRUE) {
Continued
/* initialize fields to zero */
/* continuously update structure fields */
p –>a = p –>a + 1;
p –>b = p –>b - 1;
on next
}
}
slide...
Figure 16.2
Mether system program - slide 2
Program Reader:
main()
{
struct shared *p;
methersetup();
p = (struct shared *)METHERBASE;
while(TRUE) { /* read the fields once every second */
printf("a = %d, b = %d\n", p –>a, p –>b);
sleep(1);
}
}
Figure 16.5
DSM using write-update
if(a=7) then
a := 7; b := b+1;
b := 7; ...
if(b=8) then
print("after"); updates
time
time

if(b=a) then
print("before");

time
Figure 16.6
Data items laid out over pages

A B

page n page n + 1
Figure 17.1
IDL interfaces Shape and
struct Rectangle{
1
long width;
ShapeList struct GraphicalObject {
2
string type;
long height; Rectangle enclosing;
long x; boolean isFilled;
long y; };
};
interface Shape { 3
long getVersion() ;
GraphicalObject getAllState() ; // returns state of the GraphicalObject
};

typedef sequence <Shape, 100> All; 4


interface ShapeList { 5
exception FullException{ }; 6
Shape newShape(in GraphicalObject g) raises (FullException); 7
All allShapes(); // returns sequence of remote object references 8
long getVersion() ;
};
Figure 17.2
Java interface ShapeList generated
by idltojava from CORBA interface
ShapeList
public interface ShapeList extends org.omg.CORBA.Object {
Shape newShape(GraphicalObject g) throws ShapeListPackage.FullException;
Shape[] allShapes();
int getVersion();
}
Figure 17.3
ShapeListServant class of the Java
server program for CORBA
import org.omg.CORBA.*;
class ShapeListServant extends _ShapeListImplBase {
interface ShapeList
ORB theOrb;
private Shape theList[];
private int version;
private static int n=0;
public ShapeListServant(ORB orb){
theOrb = orb;
// initialize the other instance variables
}
public Shape newShape(GraphicalObject g) throws ShapeListPackage.FullException { 1
version++;
Shape s = new ShapeServant( g, version);
if(n >=100) throw new ShapeListPackage.FullException();
theList[n++] = s; 2
theOrb.connect(s);
return s;
}
public Shape[] allShapes(){ ... }
public int getVersion() { ... }
}
Figure 17.4
Java class ShapeListServer
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;
public class ShapeListServer {
public static void main(String args[]) {
try{
ORB orb = ORB.init(args, null); 1

ShapeListServant shapeRef = new ShapeListServant(orb); 2


orb.connect(shapeRef); 3

org.omg.CORBA.Object objRef =
orb.resolve_initial_references("NameService"); 4
NamingContext ncRef = NamingContextHelper.narrow(objRef);
NameComponent nc = new NameComponent("ShapeList", ""); 5
NameComponent path[] = {nc}; 6
ncRef.rebind(path, shapeRef); 7

java.lang.Object sync = new java.lang.Object();


synchronized (sync) { sync.wait();}
Figure 17.5
Java client program for CORBA
interfaces
import Shape
org.omg.CosNaming.*; and
import org.omg.CosNaming.NamingContextPackage.*;
ShapeList
import org.omg.CORBA.*;
public class ShapeListClient{
public static void main(String args[]) {
try{
ORB orb = ORB.init(args, null);
1
org.omg.CORBA.Object objRef =
orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
NameComponent nc = new NameComponent("ShapeList", "");
NameComponent path [] = { nc };
ShapeList shapeListRef =
ShapeListHelper.narrow(ncRef.resolve(path));
2
Shape[] sList = shapeListRef.allShapes();
3
GraphicalObject g = sList[0].getAllState();
Figure 17.6
The main components of the
CORBA architecture
client server
implementation interface
repository repository object skeleton
adapter

client proxy ORB Request ORB Servant


program for A core core A
Reply

or dynamic invocation or dynamic skeleton


Figure 17.7
IDL module Whiteboard
module Whiteboard {
struct Rectangle{
...} ;
struct GraphicalObject {
...};
interface Shape {
...};
typedef sequence <Shape, 100> All;
interface ShapeList {
...};
};
Figure 17.8
IDL constructed types – 1
Type Examples Use
sequence typedef sequence <Shape, 100> All; Defines a type for a variable-length
typedef sequence <Shape> All sequence of elements of a specified
bounded and unbounded sequences IDL type. An upper bound on the
of Shapes length may be specified.
string String name; Defines a sequences of characters,
typedef string<8> SmallString; terminated by the null character. An
unboundedand bounded upper bound on the length may be
sequences of characters specified.

array typedef octet uniqueId[12]; Defines a type for a multi-dimensional


typedef GraphicalObject GO[10][8] fixed-length sequence of elements of a
specified IDL type.

this figure continues on the next slide


Figure 17.8
IDL constructed types – 2
Type Examples Use
record struct GraphicalObject { Defines a type for a record containing a
string type; group of related entities. Structs are
Rectangle enclosing; passed by value in arguments and
boolean isFilled; results.
};
enumerated enum Rand The enumerated type in IDL maps a
(Exp, Number, Name); type name onto a small set of integer
values.
union union Exp switch (Rand) { The IDL discriminated union allows
case Exp: string vote; one of a given set of types to be passed
case Number: long n; as an argument. The header is
case Name: string s; parameterized by anenum, which
}; specifies which member is in use.
Page 684
CORBA interoperable object
IOR format
references
IDL interface type nameProtocol and address details Object key
interface repository IIOP host domain port number adapter name object name
identifier name
Figure 17.9
Naming graph in CORBA
Naming Service
initial naming context initial naming context initial naming context

ShapeList B XX V
P
C
D E S T
R Q U
Figure 17.10
Part of the CORBA Naming
Service NamingContext
struct NameComponent { string id; string kind; };

interface
typedef sequence <NameComponent> Name; in IDL

interface NamingContext {
void bind (in Name n, in Object obj);
binds the given name and remote object reference in my context.
void unbind (in Name n);
removes an existing binding with the given name.
void bind_new_context(in Name n);
creates a new naming context and binds it to a given name in my context.
Object resolve (in Name n);
looks up the name in my context and returns its remote object reference.
void list (in unsigned long how_many, out BindingList bl, out BindingIterator bi);
returns the names in the bindings in my context.
};
Figure 17.11
CORBA event channels

event channel
supplier consumer

notification notification notification


proxy consumer proxy supplier

S-ar putea să vă placă și