The Balanced Sliding Window Protocol CS 60002 Distributed
The Balanced Sliding Window Protocol CS 60002: Distributed Systems INDIAN INSTITUTE OF TECHNOLOGY 1 Pallab Dasgupta Professor, Dept. of Computer Sc. & Engg. , Indian Institute of Technology Kharagpur
Definitions § Two processes, p and q, each sending an infinite array of words to the other § For Process p: inp : An infinite array of words to be sent to process q outp process q : An infinite array of words being received from Initially for all i, outp[i] = udef INDIAN OF TECHNOLOGY KHARAGPUR At. INSTITUTE any time, p has already written outp[0] through outp[sp 1] 2 sp : The lowest numbered word that p still expects to receive from q
Required Properties § Safe delivery: – In every reachable configuration of the protocol outp[0 … sp – 1] = inq[0 … sp – 1] and outq[0 … sq – 1] = inp[0 … sq – 1] § Eventual delivery: INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR 3 – For every integer k 0, a configuration with sp k and sq k is eventually reached
The protocol § The packet, < pack, w, i > , transmits the word w = inp[ i ] to q. § The processes use constants lp and lq as follows: – Process p can send the word w = inp[ i ] (as the packet, < pack, w, i > ) only after storing all the words outp[0] through outp[ i – lp ], that is, i < sp + lp. – When p receives < pack, w, i >, retransmission of words from inp[0] through INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR 4 inp[ i – lq ] is no longer necessary.
The Sliding Windows sp + l p ap inp A A A S S sq + l q aq S S A A S S inq R R u u u outq Qq p q Qp W W W u u R R u sp INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR W W u sq 5 outp
The Protocol Sp: { ap i < sp + lp } begin send < pack, inp[i], i > to q end sp + l p ap Rp: { < pack, w, i > Qp } begin receive < pack, w, i > ; inp if outp[i] = udef then A A A S S begin outp[i] = w ; ap = max{ ap, i – lq + 1 }; p sp = min{ j | outp[j] = udef } end outp // else ignore – retransmission WW WW W W u u R R u end sp Lp: { < pack, w, i > Qp } INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR 6 begin Qp = Qp { < pack, w, i > } end
Protocol Invariant P i < sp : outp[i] udef i < sq : outq[i] udef < pack, w, i > Qp w = inq[i] ( i < sq + lq ) < pack, w, i > Qq w = inp[i] ( i < sp + lp ) outp[i] udef outp[i] = inq[i] ( ap > i – lq ) outq[i] udef outq[i] = inp[i] ( aq > i – lp ) a p sq INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR 7 a q sp
Results Safety: The protocol satisfies the requirement of safe delivery Liveness: • P implies sp – lq ap sq aq + lp sp + lp • P implies that the sending of <pack, inp[sq], sq> by p or the sending of <pack, inq[sp], sp> by q is applicable. – Hence no deadlock is possible INDIAN INSTITUTE OF TECHNOLOGY KHARAGPUR 8 • The protocol satisfies the requirement of eventual delivery
- Slides: 8