190 likes | 288 Views
CIS 725. Data Link Layer. Flow Control. Producer-consumer problem Sliding window protocol - Go Back N - Selective retransmission. Go Back N. na. x. x. x. x. ns. S:: ns = 1; na = 1 do ns < na + W / avail( nl_buff ) / sbuff [ns] = null
E N D
CIS 725 Data Link Layer
Flow Control • Producer-consumer problem • Sliding window protocol - Go Back N - Selective retransmission
Go Back N na x x x x ns S:: ns = 1; na = 1 do ns < na + W /\ avail(nl_buff) /\ sbuff[ns] = null sbuff[ns] = nl_buff; R!(sbuff[ns],ns); ns++ [] sbuff[ns] != null R ! (sbuff[ns],ns); ns++ [] R ? ack(s) if s > na then na = s [] timeout ns = na od
R:: nr = 1 do S ? (D,x) if nr = x then deliver(D); nr++ S ! Ack(nr) od
Acks sent but not yet received nr na ns ns <= na + W outstanding data packets ns na 1 1 nr W = 3 d1 2 1 1 3 1 d2 2 d3 4 1 3 a2 a3 4 2 5 2 d4 d5
Cumulative Acks ns na 1 1 nr W = 3 d1 2 1 1 d2 3 1 2 d3 4 1 3 a2 a3 4 1 5 1 d4 d5
d,1 d,1 d,2 d,2 d,3 a,2 d,3 start timer start timer a,2 a,2 a,3 start timer d,4 timeout d,1 start timer d,5 d,2 - Alternative: Timeout per message
Go Back N S:: ns = 1; na = 1 do ns < na + W /\ avail(nl_buff) /\ sbuff[ns] = null sbuff[n] = nl_buff; R!(sbuff[ns],ns); ns++; if ns = na + W then start timer [] sbuff[ns] != null R ! (sbuff[ns],ns); ns++ [] R ? ack(s) if s > na then na = s; cancel timer [] timeout ns = na od
d,1 • A ------------------B • Bandwidth =108 bytes/sec • RTD = 2 msecs • 2msecs ---- 2* 105 bytes • 1 packet = 1000 bytes • W = 200 • W will also depend on • buffer space at the receiver d,2 a,2 Timeout interval = 2msecs d,W
Selective Retransmission • Retransmit only those packets the lost packets
Selective Retransmission S:: ns = 1; na = 1 do ns < na + W /\ avail(nl_buff) /\ sbuff[ns] = null sbuff[n] = nl_buff; R!(sbuff[ns],ns); ns++ [] R ? nack(s, bitmap) na = s; for (0 <= i < W) if bitmap[i] then R! (sbuff[s+i], s+i); [] timeout R ! (sbuf[na], na) od
R:: nr = 1 do S ? (D,x) rbuff[x] = D; recd[x] = true; if x != nr then S !nack(nr, bitmap) [] recd[nr] deliver(rbuff[nr]); nr++ od
R:: nr = 1 do S ? (D,x) rbuff[x] = D; recd[x] = true; if x != nr then S !nack(nr, bitmap) [] recd[nr] deliver(rbuff[nr]); nr++ od
Receiver timeout • R:: nr = 1 do S ? (D,x) rbuff[x] = D; recd[x] = true; [] timeout S !nack(nr, bitmap) [] recd[nr] deliver(rbuff[nr]); nr++ od
Receiver based Windows • S:: ns = 1; na = 1 do : : [] R ? Ack(s,x) W = x; if s > na then na = s od
R:: nr = 1 do S ? (D,x) if nr = x then deliver(D); nr++; compute W; S ! ack(nr, W); od