DSConceptsDec2

download DSConceptsDec2

of 53

Transcript of DSConceptsDec2

  • 8/6/2019 DSConceptsDec2

    1/53

    Distributed Systems Concepts

    Ch. 10 and 14-17

  • 8/6/2019 DSConceptsDec2

    2/53

    gure .Skew between computer clocks

    in a distributed system

    Network

  • 8/6/2019 DSConceptsDec2

    3/53

    gure .Clock synchronization using a

    time server

    mr

    mtp Time server,S

  • 8/6/2019 DSConceptsDec2

    4/53

    .An example synchronization

    subnet in an TPimplementation

    1

    2

    3

    2

    3 3

    ote: Arrows denote synchronization control, numbers denotestrata.

  • 8/6/2019 DSConceptsDec2

    5/53

    gure .Messages exchanged between

    a pair of TP peers

    Ti

    Ti-1Ti-2

    Ti- 3

    Server B

    Server A

    Time

    m m'

    Time

  • 8/6/2019 DSConceptsDec2

    6/53

    gure .Events occurring at three

    processesp1

    p

    p

    a

    c

    e f

    1

    h sical

    ti e

  • 8/6/2019 DSConceptsDec2

    7/53

    gure .Lamport timestamps for the

    events shown in Figure 10.5

    a

    e f

    m1

    m

    1

    51

    p1

    p

    p

    h si altime

  • 8/6/2019 DSConceptsDec2

    8/53

    gure .Vector timestamps for the

    events shown in Figure 10.5

    a

    c

    e f

    m1

    m

    ( 0 0)(1 0 0)

    ( 1 0) ( 0)

    ( )(0 0 1)

    p1

    p

    p

    h sicatime

  • 8/6/2019 DSConceptsDec2

    9/53

    Figure 10.8

    Detecting global propertiesp

    p1

    essage

    garbage object

    object

    re erence

    a. Garbage collection

    p p1 ait or

    ait or b. Dea loc

    p p1

    acti ate

    passi e passi ec. er ination

  • 8/6/2019 DSConceptsDec2

    10/53

    Figure 10.9

    Cuts

    1

    1

    si lti e

    e10

    C siste t utI siste t ut

    e11

    e12

    e13

    e20

    e 21

    e 22

  • 8/6/2019 DSConceptsDec2

    11/53

    gure .Chandy and Lamports

    snapshot algorithmMarker receiving rule for process piOnpis receipt of a markermessage over channel c:

    if(pi has not yet recorded its state) it

    records its process state now;

    records the state ofc as the empty set;turns on recording of messages arriving over other incoming channel

    else

    pi records the state ofc as the set of messages it has received overc

    since it saved its state.

    end if

    Marker sending rule for process piAfterpi has recorded its state, for each outgoing channel c:

    pi sends one marker message overc

    (before it sends any other message overc).

  • 8/6/2019 DSConceptsDec2

    12/53

    gure .Two processes and their initial

    states

    p1 pc

    c1

    account widgets

    $1000 (none)

    account widgets

    $ 0 000

  • 8/6/2019 DSConceptsDec2

    13/53

  • 8/6/2019 DSConceptsDec2

    14/53

    gure .Reachability between states in

    the snapshot algorithm

    init inal

    snap

    actual e ecution e0 e1 ...

    recor ing recor ingbegins en s

    pre snap e'0 e'1 ...e'R 1 post snap e'R e'R+1 ...

  • 8/6/2019 DSConceptsDec2

    15/53

  • 8/6/2019 DSConceptsDec2

    16/53

    Chapter 11,12, and 13

    Are on transaction an concurrency controlthat are typically covered in a data basecourse.

  • 8/6/2019 DSConceptsDec2

    17/53

    Ch 14: Fault Tolerance

  • 8/6/2019 DSConceptsDec2

    18/53

    .A basic architectural model for

    the management of replicateddata

    FE

    Requests and

    replies

    C

    ReplicaC

    ServiceClients Front ends

    managers

    RM

    RMFE

    RM

  • 8/6/2019 DSConceptsDec2

    19/53

    Figure 14.2Services provided for process groups

    Join

    roupaddress

    expansion

    Multicastcommunication

    roupsend

    Failroup membershipmanagement

    Leave

    Process group

  • 8/6/2019 DSConceptsDec2

    20/53

    Figure 14.3View-synchronous group communication

    p

    q

    r

    p crashes

    view q, rview p, q, r

    p

    q

    r

    p crashes

    view q, rview p, q, r

    a allowed . b allowed .

    p

    q

    r

    view p, q, r

    p

    q

    r

    p crashes

    view q, rview p, q, r

    c disallowed . d disallowed .

    p crashes

    view q, r

  • 8/6/2019 DSConceptsDec2

    21/53

  • 8/6/2019 DSConceptsDec2

    22/53

    Figure 14.5

    Active replication

    FE CFEC RM

    RM

    RM

  • 8/6/2019 DSConceptsDec2

    23/53

    Ch.15: Distributed MultimediaSystems

  • 8/6/2019 DSConceptsDec2

    24/53

    Figure 15.1

    A distributed multimedia system

    Wide area gate ay ideser er

    igital/radi

    ser er

    ide ameraa d mi e

    al et r al et r

  • 8/6/2019 DSConceptsDec2

    25/53

    .The window of scarcity for

    computing and communicationresources

    1 1

    remoteogin

    networfi e access

    high ua ityaudio

    interacti eideo

    insufficient

    resources

    scarce

    resources

    a undantresources

    2

  • 8/6/2019 DSConceptsDec2

    26/53

    gure .Characteristics of typical

    multimedia streamsData rate

    (approximate)Sample or frame

    sizefrequency

    Telephone speech 64 kbps 8 bits 8000/secCD-quality sound 1.4 Mbps 16 bits 44,000/secStandard TV video(uncompressed)

    120 Mbps up to 640x 480pixelsx 16 bits

    24/sec

    Standard TV video(MPEG-1 compressed)

    1.5 Mbps variable 24/sec

    HDTV video(uncompressed)

    10003000 Mbpsup to 1920x 1080pixelsx 24 bits

    2460/sec

    HDTV videoMPEG-2 compressed)

    1030 Mbps variable 2460/sec

  • 8/6/2019 DSConceptsDec2

    27/53

    .Typical infrastructure

    components for multimediaapplications

    Microphones

    Camera

    Screen

    indowsystem

    CodecD

    B Mixer

    PC workstation PC workstation

    CVideostore

    etworkconnections

    K

    L

    M

    : multimediastream

    CodecA

    Codec

    H

    indowsystem

    hite boxes represent media processing components,many of which are implemented in software, including:codec:coding decodingfilter

    mixer: sound-mixingcomponent

    Videofile system

  • 8/6/2019 DSConceptsDec2

    28/53

    .QoS specifications for

    components of the applicationshown in Figure 15.4Component Bandwidth Latency Loss rate Resources required Camera Out: 10 frames/sec, raw video

    640x480x16 bitsZero

    A Codec In:

    Out:

    10 frames/sec, raw video

    MPEG-1 stream

    Interactive Low 10 ms CPU each 100 ms;

    10 Mbytes RAMB Mixer In:

    Out:

    2 44 kbps audio

    1 44 kbps audio

    Interactive Very low 1 ms CPU each 100 ms;

    1 Mbytes RAM

    H Windowsystem

    In:

    Out:

    various

    50 frame/sec framebuffer

    Interactive Low 5 ms CPU each 100 ms;

    5 Mbytes RAM

    K Networkconnection

    In/Out: MPEG-1 stream, approx.1.5 Mbps

    Interactive Low 1.5 Mbps, low-lossstream protocol

    L Network connection

    In/Out: Audio 44 kbps Interactive Very low 44 kbps, very low-lossstream protocol

  • 8/6/2019 DSConceptsDec2

    29/53

  • 8/6/2019 DSConceptsDec2

    30/53

  • 8/6/2019 DSConceptsDec2

    31/53

    Figure 15.8

    The RFC 1363 Flow SpecProtocol version

    Maximum transmission unit

    Token bucket rate

    Token bucket sizeMaximum transmission rate

    Minimum delay noticed

    Maximum delay variation

    Loss sensitivity

    Burst loss sensitivity

    Loss interval

    Quality of guarantee

    Bandwidth:

    Delay:

    Loss:

  • 8/6/2019 DSConceptsDec2

    32/53

    Figure 15.9

    Filtering

    Source Targets

    Highbandwidth

    Mediumbandwidth

    Lowbandwidth

  • 8/6/2019 DSConceptsDec2

    33/53

    gure .Tiger video file server hardware

    configurationController

    Cub 0 Cub 1 Cub 2 Cub 3 Cub n

    ATM switching network

    video distribution to clientsStart Stop

    requests from clients

    low-bandwidth network

    high-bandwidth

    0 n 1 1 n 2 2 n 3 n 4 n 2n 13

  • 8/6/2019 DSConceptsDec2

    34/53

    Figure 15.11

    Tiger schedule

    012

    slot 0

    viewer 4

    slot 1

    free

    slot 2

    free

    slot 3

    viewer 0

    slot 4

    viewer 3

    slot 5

    viewer 2

    slot 6

    free

    slot 7

    viewer 1

    block play timeT

    block servicetimet

    state state state state state

  • 8/6/2019 DSConceptsDec2

    35/53

    16: Distributed Shared Memory

  • 8/6/2019 DSConceptsDec2

    36/53

    gure .The distributed shared memory

    abstraction

    hysicalmemory

    rocess

    accessing

    a ears asmemory in address

    s ace of rocess

    hysicalmemory

    hysicalmemory

    istributed shared memory

  • 8/6/2019 DSConceptsDec2

    37/53

    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;

    }

    }

    Continuedon nextslide...

  • 8/6/2019 DSConceptsDec2

    38/53

    Figure 16.2

    Mether system program - slide 2ProgramReader: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);

    }

    }

  • 8/6/2019 DSConceptsDec2

    39/53

    Figure 16.5

    DSM using write-update

    time

    time

    a ;

    ;

    i t en

    print "a ter" ;

    i a t en

    1;...

    i a t en print " e re" ;

    time

    updates

  • 8/6/2019 DSConceptsDec2

    40/53

    Figure 16.6

    Data items laid out over pages

    A B

    page n 1page n

  • 8/6/2019 DSConceptsDec2

    41/53

    gure .IDL interfaces Shape and

    ShapeListstructRectangle{

    1

    long width;

    long height;

    long x;

    long y;

    } ;

    struct GraphicalObject{ 2

    string type;

    Rectangle enclosing;

    boolean isFilled;

    };

    interface Shape { 3long getVersion() ;

    GraphicalObject getAllState() ; // returns state of the GraphicalObject

    };

    typedef sequence 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() ;

    };

  • 8/6/2019 DSConceptsDec2

    42/53

    .Java interface ShapeListgeneratedby idltojava from C RBA interface

    ShapeList

    public interface ShapeList extends org.omg.CORBA.Object {

    Shape newShape(GraphicalObject g) throws ShapeListPackage.FullException;Shape[] allShapes();

    int getVersion();

    }

  • 8/6/2019 DSConceptsDec2

    43/53

  • 8/6/2019 DSConceptsDec2

    44/53

    Figure 17.4

    Java class ShapeListServerimport 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); 1ShapeListServant 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);

    NameC

    omponent nc = new NameC

    omponent("ShapeList", ""); 5NameComponent path[] = {nc}; 6

    ncRef.rebind(path, shapeRef); 7

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

    synchronized (sync) { sync.wait();}

    } catch (Exception e) { ... }

    }

    gure

  • 8/6/2019 DSConceptsDec2

    45/53

    gure .Java client program for C RBA

    interfaces Shape and ShapeListimport 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();

    gure

  • 8/6/2019 DSConceptsDec2

    46/53

    gure .The main components of the

    C RBA architecture

    client server

    proxy

    or dynamic invocation

    implementationrepository ob ect

    adapter

    RBRB

    skeleton

    or dynamic skeleton

    clientprogram

    interfacerepository

    Request

    Replycorecorefor A

    ServantA

  • 8/6/2019 DSConceptsDec2

    47/53

    Figure 17.7

    IDL module hiteboardmodule Whiteboard {struct Rectangle{

    ...} ;

    struct GraphicalObject {

    ...};

    interface Shape {

    ...};

    typedef sequence All;

    interface ShapeList {...};

    };

  • 8/6/2019 DSConceptsDec2

    48/53

    Figure 17.8

    IDL constructed types 1Type Examples Usesequence typedef sequence All;

    typedef sequence Allbounded and unbounded sequencesof Shapes

    Defines a type for a variable-lengthsequence of elements of a specifiedIDL type. An upper bound on thelength may be specified.

    string String name;typedef string SmallString;

    unboundedand boundedsequences of characters

    Defines a sequences of characters,terminated by the null character. An

    upper bound on the length may bespecified.

    array typedef octet uniqueId[12];

    typedef GraphicalObject GO[10][8]

    Defines a type for a multi-dimensional

    fixed-length sequence of elements of aspecified IDL type.

    this figure continues on the next slide

  • 8/6/2019 DSConceptsDec2

    49/53

    Figure 17.8IDL constructed types 2

    Type Examples Use

    record struct GraphicalObject {string type;Rectangle enclosing;boolean isFilled;

    };

    Defines a type for a record containing agroup of related entities. Structs arepassed by value in arguments andresults.

    enumerated enum Rand(Exp, Number, Name);

    The enumerated type in IDL maps atype name onto a small set of integervalues.

    union union Exp switch (Rand) {case Exp: string vote;case Number: long n;case Name: string s;

    The IDL discriminated union allowsone of a given set of types to be passedas an argument. The header isparameterized by anenum, whichspecifies which member is in use.};

    age

  • 8/6/2019 DSConceptsDec2

    50/53

    ageC RBA interoperable ob ect

    referencesIOR formatIDL interface type nameProtocol and address details Object key

    interface repositoryidentifier

    IIOP host domainname

    port number adapter name object name

    gure

  • 8/6/2019 DSConceptsDec2

    51/53

    gure .aming graph in C RBA

    aming Serviceinitial naming context

    ShapeList

    CD E

    B

    initial naming context

    P

    R ST

    V

    Q U

    initial naming context

    XX

  • 8/6/2019 DSConceptsDec2

    52/53

    .Part of the C RBA aming

    Service amingContextinterface in IDL

    struct NameComponent { string id; string kind; };

    typedef sequence Name;

    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.

    };

  • 8/6/2019 DSConceptsDec2

    53/53

    Figure 17.11C RBA event channels

    consumersupplier

    proxy consumer

    notification

    proxy supplier

    event channel

    notificationnotification