distributed progrms

Upload: sanapala-amit

Post on 02-Jun-2018

213 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 Distributed Progrms

    1/15

    Distributed Programs

    Dr. Mattox Beckman

    Illinois Institute of Technology

    Department of Computer Science

    http://find/
  • 8/10/2019 Distributed Progrms

    2/15

    Outline

    http://find/
  • 8/10/2019 Distributed Progrms

    3/15

    Motivation

    Distributed programs are an amazing way of handling concurrency.

    No interference!

    Scales well to large systems.

    http://find/
  • 8/10/2019 Distributed Progrms

    4/15

    Syntax

    A sequential process has the form

    SS0; domj1gjSj od

    where m 0andS0, . . . , Snare nondeterminstic programs. S0is the initialization code.

    There may be loops inside of eachSi.

    g B; Bis a guard is of formc?u an input command, or c!t an output command.

    http://find/
  • 8/10/2019 Distributed Progrms

    5/15

    Example

    SR[SENDERRECIVER] (1)SENDERi:= 0; do i =|a|; link!a[i] i:= i+ 1 od (2)

    RECEIVERj:= 0; do j =|b|; link?b[j] j:=j+ 1 od (3)

    http://find/
  • 8/10/2019 Distributed Progrms

    6/15

    Activity

    Do the Distributed Program Activity

    http://find/
  • 8/10/2019 Distributed Progrms

    7/15

    Semantics

    First we talk about termination.

    < domj=1gjSj od , >

    where forj {1, . . . , n}gjBj; jand |=mj=1Bj

    We also want to talk about the meaning of a communication.

    1=c?u2

    =c!tEff(1, 2) =Eff(2, 1) =u:=t

    http://find/http://goback/
  • 8/10/2019 Distributed Progrms

    8/15

    Communication

    Sk= dom1j=1gjRj od

    Sl= dom2j=1hjTj od

    gj1 =B1; 1hj2 =B2; 2

    |=B1 B2

    M[[Eff(1, 2)]]() ={}Si Sifori =k, lSkRj1 ; SkSl Tj2 ; Sl

    http://find/http://goback/
  • 8/10/2019 Distributed Progrms

    9/15

    Transforming to a nondeterministic program

    Suppose each process has form

    SiSi,0; domij=1Bi,j; i,jSi,j od

    Letbe a list of matching communications:

    ={(i,j, k, l)|i,jand k,lmatch andi

  • 8/10/2019 Distributed Progrms

    10/15

    Activity

    Do the Distributed Conversion Activity

    http://find/
  • 8/10/2019 Distributed Progrms

    11/15

    Proving Deadlock

    The partial correctness will be the same, but what about deadlock? Given

    T(S) S1,0; S2,0; ; Sn,0;

    do(i,j,k,l)Bi,j Bk,lEff(i,j, k,l); Si,j; Sk,lod

    We defineTERMandBLOCK. How are they different?

    TERMn

    i=1mi

    j=1 Bi,

    jBLOCK

    (i,j,k,l) (Bi,j Bk,l)

    Which is the stronger ofTERMandBLOCK?

    What doesBLOCK TERMtell us?

    http://find/
  • 8/10/2019 Distributed Progrms

    12/15

    Partial Correctness: Rule 19

    {p}S1,0; ; Sn,0{I},

    {I Bi,j Bk,l}Eff(i,j, k,l); Si,j; Sk,l{I}for all(i,j, k, l)

    {p}S{I TERM}

    What do we have to do to add weak total correctness?

    http://find/
  • 8/10/2019 Distributed Progrms

    13/15

    Weak Total Correctness: Rule 20

    {p}S1,0; ; Sn,0{I},{I Bi,j Bk,l}Eff(i,j, k,l); Si,j; Sk,l{I}

    for all(i,j, k, l) {I Bi,j Bk,l t=z}Eff(i,j, k,l); Si,j; Sk,l{t

  • 8/10/2019 Distributed Progrms

    14/15

    Total Correctness: Rule 21

    {p}S1,0; ; Sn,0{I},{I Bi,j Bk,l}Eff(i,j, k,l); Si,j; Sk,l{I}

    for all(i,j, k, l) {I Bi,j Bk,l t=z}Eff(i,j, k,l); Si,j; Sk,l{t

  • 8/10/2019 Distributed Progrms

    15/15

    Activity

    Do the Distributed Deadlock Activity

    http://find/