Distributed Systems Concepts Ch. 10 and 14-17

advertisement
Distributed Systems Concepts
Ch. 10 and 14-17
Figure 10.1
Skew between computer clocks
in a distributed system
Netw ork
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
3
2
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
m
Ti-1
Time
m'
Time
Server A
Ti- 3
Ti
Figure 10.5
Events occurring at three
processes
p1
a
b
m1
Phy sical
time
p2
c
d
m2
p3
e
f
Figure 10.6
Lamport timestamps for the
events shown in Figure 10.5
p1
1
2
a
b
p2
m1
3
4
c
d
Phy sical
time
m2
1
5
e
f
p3
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)
p2
c
(0,0,1)
(2,2,0)
d
Phy sical
time
m2
(2,2,2)
p3
e
f
Figure 10.8
Detecting global properties
p2
p1
objec t
referenc e
mess age
a. Garbage collec tion
garbage objec t
p1
w ait-for
b. Deadlock
p2
w ait-for
p2
p1
activate
c . Termination
pas sive
pas sive
Figure 10.9
Cuts
0
e1
1
2
e1
3
e1
e1
p1
m1
p2
m2
0
e2
1
e2
2
e2
Incons is tent cut
Cons is tent c ut
Phys ic al
time
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
c2
p1
p2
c1
$1000
(none)
$50
2000
acc ount
w idgets
acc ount
w idgets
Figure 10.12
The execution of the processes
in Figure 10.11
1. Global state S0
2. Global state S1
3. Global state S2
4. Global state S3
<$1000, 0>
<$900, 0>
<$900, 0>
<$900, 5>
p1
p1
p1
p1
c2
(empty )
c1
(empty )
c2
(Order 10, $100), M
c1
(empty )
c2
(Order 10, $100), M
c1
(fiv e w idgets )
c2
(Order 10, $100)
c1
(empty )
(M = marker mes sage)
p2
<$50, 2000>
p2
<$50, 2000>
p2
<$50, 1995>
p2
<$50, 1995>
Figure 10.13
Reachability between states in
the snapshot algorithm
ac tual ex ec ution e0 ,e 1,...
Sini t
rec ording
begins
pre-snap: e'0 ,e'1 ,...e'R- 1
rec ording
ends
Ssnap
Sfi nal
post-snap: e' R,e 'R+1 ,...
Figure 10.14
Vector timestamps and variable
values for the execution of
Figure 10.9(4,3)
(1,0) (2,0)
(3,0)
x1= 1 x1 = 100 x1 = 105
x1= 90
p1
m1
m2
Phys ic al
time
p2
x2 = 100 x2 = 95
(2,1) (2,2)
Cut C1
x2 = 90
(2,3)
Cut C2
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
data
replies
C
Clients
FE
Front ends
C
FE
RM
RM
Service
RM
Replica
managers
Figure 14.2
Services provided for process groups
Group
address
expansion
Group
send
Multicast
communication
Leave
Fail
Join
Process group
Group membership
management
Figure 14.3
View-synchronous
group
communication
a (allowed).
b (allowed).
p crashes
p crashes
p
p
q
q
r
r
view (p, q, r)
view (q, r)
c (disallowed).
view (p, q, r)
view (q, r)
d (disallowed).
p crashes
p crashes
p
p
q
q
r
r
view (p, q, r)
view (q, r)
view (p, q, r)
view (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
RM
FE
C
Ch.15: Distributed Multimedia
Systems
Figure 15.1
A distributed multimedia system
Vi deo cam era
an d mi ke
Lo cal netwo rk
Lo cal netwo rk
Wi de a rea g ateway
Vi deo
se rve r
Digi tal
TV/radi o
se rve r
Figure 15.2
The window of scarcity for
computing and communication
resources
interactive
video
hig h-qua lity
aud io
ins uffi cie nt
reso urce s
scarce
reso urce s
abu ndan t
reso urce s
netwo rk
fil e acce ss
remo te
log in
198 0
199 0
200 0
Figure 15.3
Characteristics of typical
multimedia streams
Data rate
(approximate)
Sample or frame
size
frequency
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 Mbpsup 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/works tati on
PC/works tati on
Win dow syste m
Camera
K
A
Codec
Micro phon es
Scre en
B
G
Codec
H
L
Mixer
Network
co nnectio ns
C
Vid eo fil e syste m
D
Codec
M
Vid eo
sto re
Win dow syste m
: multime diastre am
White b oxes re prese nt m edia process ing com pone nts,
man y of which are i mple mented i n so ftware, includ ing:
co dec: co ding /decodingfil ter
mixer: sou nd-mi xi ngco mponent
Figure 15.5
QoS specifications for
components of the application
shown in Figure 15.4
Component
Bandwidth
Latency
Out:
10 frames/sec, raw video
Camera
640x480x16 bits
A Codec
In:
10 frames/sec, raw videoInteractive
Out:
MPEG-1 stream
B Mixer
In:
2 44 kbps audio
Interactive
Out:
1 44 kbps audio
H Window In:
various
Interactive
system
Out:
50 frame/sec framebuffer
K Network In/Out: MPEG-1 stream, approx.Interactive
connection
1.5 Mbps
L Network In/Out: Audio 44 kbps
Interactive
connection
Loss rate Resources required
Zero
Low
10 ms CPU each 100 ms;
10 Mbytes RAM
Very low 1 ms CPU each 100 ms;
1 Mbytes RAM
Low
5 ms CPU each 100 ms;
5 Mbytes RAM
Low
1.5 Mbps, low-loss
stream protocol
Very low 44 kbps, very low-loss
stream protocol
Figure 15.6
The QoS manager’s task
Adm issi onco ntrol
QoS neg otia tion
Application components s pecify their QoS
requirements to QoS manager
Flo w spec.
QoS manager ev aluates new requirements
agains t the av ailable res ources.
Suffic ient?
Yes
Reserve the requested res ources
Resource contract
Allow applic ation to proceed
Application runs w ith res ources as
per resourc e c ontract
No
Negotiate reduc ed res ource provision w ith applic ation.
Agreement?
Yes
No
Do not allow applic ation to proceed
Application notifies QoS manager of
increas ed res ource 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
Bandwidth:
Token bucket rate
Token bucket size
Maximum transmission rate
Delay:
Minimum delay noticed
Maximum delay variation
Loss sensitivity
Loss:
Burst loss sensitivity
Loss interval
Quality of guarantee
Figure 15.9
Filtering
Source
Highbandwidth
Mediumbandwidth
Lowbandwidth
Targets
Figure 15.10
Tiger video file server hardware
configuration
Controller
low-bandwidth network
0
n+1
Cub 0
1
n+2
Cub 1
2
n+3
Cub 2
3
n+4
Cub 3
n
2n+1
Cub n
high-bandwidth
ATM switching network
video distribution to clients
Start/Stop
requests from clients
Figure 15.11
Tiger schedule
2
block service
time t
1
block play timeT
0
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 s hared memory
DSM appears as
memory in address
spac e of proc es s
Process
ac cess ing DSM
Phys ic al
memory
Phys ic al
memory
Phys ic al
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;
/* initialize fields to zero */
while(TRUE) {
/* continuously update structure fields */
p –>a = p –>a + 1;
p –>b = p –>b - 1;
}
}
Continued
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
ti me
if(b=a) then
print("before");
time
Figure 16.6
Data items laid out over pages
A
page n
B
page n + 1
Figure 17.1
IDL interfaces Shape and
ShapeList
struct
Rectangle{
1
long width;
long height;
long x;
long y;
};
interface
Shape {
long getVersion() ;
GraphicalObject getAllState() ;
};
struct GraphicalObject
{ 2
string type;
Rectangle enclosing;
boolean isFilled;
};
3
// returns state of the GraphicalObject
typedef sequence <Shape, 100> All;
interface ShapeList {
exception FullException{ };
Shape newShape(in GraphicalObject g) raises (FullException);
All allShapes();
// returns sequence of remote object references
long getVersion() ;
};
4
5
6
7
8
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
interface ShapeList
import org.omg.CORBA.*;
class ShapeListServant extends _ShapeListImplBase {
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 {
version++;
Shape s = new ShapeServant( g, version);
if(n >=100) throw new ShapeListPackage.FullException();
theList[n++] = s;
theOrb.connect(s);
return s;
}
public Shape[] allShapes(){ ... }
public int getVersion() { ... }
}
1
2
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);
ShapeListServant shapeRef = new ShapeListServant(orb);
orb.connect(shapeRef);
org.omg.CORBA.Object objRef =
orb.resolve_initial_references("NameService");
NamingContext ncRef = NamingContextHelper.narrow(objRef);
NameComponent nc = new NameComponent("ShapeList", "");
NameComponent path[] = {nc};
ncRef.rebind(path, shapeRef);
java.lang.Object sync = new java.lang.Object();
synchronized (sync) { sync.wait();}
} catch (Exception e) { ... }
}
}
1
2
3
4
5
6
7
Figure 17.5
Java client program for CORBA
interfaces
Shape
and
ShapeList
import
org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
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
client proxy ORB
program for A core
or dynamic invocation
implementation
repository
Request
Reply
server
interface
repository
object skeleton
adapter
ORB
core
Servant
A
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
string
array
typedef sequence <Shape> All
bounded and unbounded sequences
of Shapes
String name;
typedef string<8> SmallString;
unboundedand bounded
sequences of characters
sequence of elements of a specified
IDL type. An upper bound on the
length may be specified.
Defines a sequences of characters,
terminated by the null character. An
upper bound on the length may be
specified.
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 {
string type;
Rectangle enclosing;
boolean isFilled;
};
Defines a type for a record containing a
group of related entities. Structs are
passed by value in arguments and
results.
enumerated
enum Rand
(Exp, Number, Name);
The enumerated type in IDL maps a
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
parameterized by anenum, which
case Name: string s;
specifies which member is in use.
};
Page 684
CORBA interoperable object
references
IOR format
IDL interface type nameProtocol and address details
interface repository
identifier
IIOP host domain
name
Object key
port number adapter name object name
Figure 17.9
Naming graph in CORBA
Naming Service
initial naming context
initial naming context
B
ShapeList
initial naming context
XX
P
V
C
D
E
R
Q
S
T
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
proxy consumer
notification
proxy supplier
Download