Figure 10.1 Skew between computer clocks in a distributed system Distributed Systems Concepts

advertisement
Figure 10.1
Skew between computer clocks
in a distributed system
Distributed Systems Concepts
Ch. 10 and 14-17
Network
Figure 10.3
An example synchronization
subnet in an NTP
implementation
Figure 10.2
Clock synchronization using a
time server
1
mr
2
2
mt
p
Time server,S
3
3
3
Note: Arrows denote synchronization control, numbers denote
strata.
Figure 10.4
Messages exchanged between
a pair of NTP peers
Figure 10.5
Events occurring at three
processes
p1
Server B
Ti-2
m
a
Ti-1
Ti- 3
Ti
m1
Physical
time
p2
m'
c
Time
Server A
b
Time
d
m2
p3
e
f
1
Figure 10.6
Lamport timestamps for the
events shown in Figure 10.5
1
p1
(1,0,0) (2,0,0)
2
a
b
p2
p3
Figure 10.7
Vector timestamps for the
events shown in Figure 10.5
p1
m1
3
4
c
d
Physical
time
m2
1
5
e
f
a
b
m1
(2,1,0)
p2
p3
(2,2,2)
f
Figure 10.9
Cuts
0
e1
message
a. Garbage collection
garbage object
1
2
e1
3
e1
e1
p1
m1
p1
wait-for
b. Deadlock
p2
Physical
time
m2
e
p2
p1
d
(0,0,1)
Figure 10.8
Detecting global properties
object
reference
(2,2,0)
c
m2
p2
0
e2
wait-for
1
e2
Physical
time
2
e2
Inconsistent cut
Consistent cut
p2
p1
activate
c. Termination
passive
passive
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 channel
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
account
widgets
account
widgets
2
Figure 10.12
The execution of the processes
in Figure 10.11
1. Global state S
0
<$1000, 0>
2. Global state S
1
<$900, 0>
3. Global state S
2
<$900, 0>
4. Global state S
3
<$900, 5>
p1
p1
p1
p1
c2
(empty)
c1
(empty)
c2
(Order 10, $100), M
c1
(empty)
c2
(Order 10, $100), M
c1
(five widgets)
c2
(Order 10, $100)
c1
(empty)
p2
<$50, 2000>
p2
<$50, 2000>
p2
<$50, 1995>
Figure 10.13
Reachability between states in
the snapshot algorithm
actual execution 0e,e1,...
Sinit
recording
begins
pre-snap: e'0 ,e'1 ,...e'R-1
p2
recording
ends
Ssnap
Sfinal
post-snap: e' R,e'R+1,...
<$50, 1995>
(M = marker message)
Figure 10.14
Vector timestamps and variable
values for the execution of
Figure 10.9(4,3)
(1,0) (2,0) (3,0)
x1= 90
x1= 1 x1 = 100 x1 = 105
p1
m1
p2
Chapter 11,12, and 13
• Are on transaction an concurrency control
that are typically covered in a data base
course.
m2
x2 = 100 x2 = 95
(2,1) (2,2)
x2 = 90
(2,3)
Physical
time
Cut C2
Cut C1
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
3
Figure 14.2
Services provided for process groups
Figure 14.3
View-synchronous
group
communication
a (allowed).
b (allowed).
p crashes
Group
address
expansion
p
q
q
r
r
Leave
Group
send
view (p, q, r)
Multicast
communication
p crashes
p
Group membership
management
Fail
view (q, r)
view (p, q, r)
c (disallowed).
d (disallowed).
p crashes
p crashes
Join
p
p
q
q
r
r
Process group
view (p, q, r)
Figure 14.4
The passive (primary-backup)
model for fault
tolerance
Primary
C
FE
Backup
C
FE
view (q, r)
view (p, q, r)
view (q, r)
Figure 14.5
Active replication
RM
RM
RM
view (q, r)
C
FE
RM
RM
FE
C
RM
Backup
Ch.15: Distributed Multimedia
Systems
Figure 15.1
A distributed multimedia system
Video camera
and mike
Local network
Local network
Wide area gateway
Video
server
Digital
TV/radio
server
4
Figure 15.2
The window of scarcity for
computing and communication
resources
interactive
video
high-quality
audio
insufficient
resources
scarce
resources
remote
login
1980
PC/workstation
PC/workstation
Windowsystem
A
Microphones
Screen
B
K
G
Codec
Codec
H
Network
connections
C
Videofile system
D
M
Codec
Figure 15.5
QoS specifications for
components of the application
shown in Figure 15.4
Component
Bandwidth
Latency
Out:
10 frames/sec, raw video
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
Camera
L
Mixer
Sample or frame
size
frequency
2000
1990
Figure 15.4
Typical infrastructure
components for multimedia
applications
Camera
Data rate
(approximate)
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)
abundant
resources
network
file access
Figure 15.3
Characteristics of typical
multimedia streams
Video
store
Window system
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
: multimediastream
White boxes represent media processing components,
many of which are implemented in software, including:
codec:coding/decodingfilter
mixer: sound-mixingcomponent
Figure 15.6
The QoS manager’s task
Admissioncontrol
QoS negotiation
Application components specify their QoS
requirements to QoS manager
Figure 15.7
Traffic shaping algorithms
(a) Leaky bucket
(b) Token bucket
Flow spec.
QoSmanagerevaluatesnew requirements
against theavailableresources.
Sufficient?
Yes
Reservethe requestedresources
Resource contract
Allow applicationto proceed
Application runs with resources as
per resource contract
No
Negotiatereducedresourceprovisionwith application.
Agreement?
Yes
Token generator
No
Do not allow applicationto proceed
Applicationnotifies QoS managerof
increasedresource requirements
5
Figure 15.8
The RFC 1363 Flow Spec
Figure 15.9
Filtering
Protocol version
Maximum transmission unit
Token bucket rate
Bandwidth:
Token bucket size
Source
Maximum transmission rate
Targets
Minimum delay noticed
Delay:
Maximum delay variation
Loss sensitivity
Loss:
Highbandwidth
Burst loss sensitivity
Mediumbandwidth
Lowbandwidth
Loss interval
Quality of guarantee
Figure 15.10
Tiger video file server hardware
configuration
Figure 15.11
Tiger schedule
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
2
Cub n
high-bandwidth
ATM switching network
block service
time t
1
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
video distribution to clients
block play timeT
state
Start/Stop
requests from clients
16: Distributed Shared Memory
Figure 16.1
The distributed shared memory
abstraction
Distributed shared memory
DSM appears as
memory in addres
space of process
Process
accessing DSM
Physical
memory
Physical
memory
Physical
memory
6
Figure 16.2
Mether system program - slide 1
Figure 16.2
Mether system program - slide 2
#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.5
DSM using write-update
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.6
Data items laid out over pages
if(a=7) then
a := 7;
b := 7;
b := b+1;
...
if(b=8) then
print("after");
A
updates
B
time
time
page n
page n + 1
if(b=a) then
print("before");
time
Figure 17.2
Figure 17.1
IDL interfaces Shape and
ShapeList
struct
Rectangle{
1
long width;
long height;
long x;
long y;
Shape {
}interface
;
long getVersion() ;
GraphicalObject getAllState() ;
};
Java interface ShapeList generated
by idltojava from CORBA interface
ShapeList
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() ;
};
public interface ShapeList extends org.omg.CORBA.Object {
Shape newShape(GraphicalObject g) throws ShapeListPackage.FullException;
Shape[] allShapes();
int getVersion();
}
4
5
6
7
8
7
Figure 17.3
Figure 17.4
Java class ShapeListServer
import org.omg.CosNaming.*;
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() { ... }
}
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();
4
1
2
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) { ... }
}
}
4
5
6
7
Figure 17.6
The main components of the
CORBA architecture
client
client proxy ORB
program for A core
implementation
repository
server
interface
repository
Request
Reply
or dynamic invocation
Figure 17.7
IDL module Whiteboard
module Whiteboard {
struct Rectangle{
...} ;
struct GraphicalObject {
...};
interface Shape {
...};
typedef sequence <Shape, 100> All;
interface ShapeList {
...};
};
1
2
3
object skeleton
adapter
ORB
core
Servant
A
or dynamic skeleton
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
8
Page 684
CORBA interoperable object
references
IOR format
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
one of a given set of types to be passed
case Exp: string vote;
as an argument. The header is
case Number: long n;
parameterized by anenum, which
case Name: string s;
specifies which member is in use.
};
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
S
Q
T
U
IDL interface type nameProtocol and address details
interface repository
identifier
IIOP host domain
name
Object key
port number adapter name object name
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
9
Download