Presentation is loading. Please wait.

Presentation is loading. Please wait.

Chapter 3, slide: 1 CS 372 – introduction to computer networks* Thursday July 8 Announcements: r Lab 3 is posted and due is Monday July 19. r Midterm is.

Similar presentations


Presentation on theme: "Chapter 3, slide: 1 CS 372 – introduction to computer networks* Thursday July 8 Announcements: r Lab 3 is posted and due is Monday July 19. r Midterm is."— Presentation transcript:

1 Chapter 3, slide: 1 CS 372 – introduction to computer networks* Thursday July 8 Announcements: r Lab 3 is posted and due is Monday July 19. r Midterm is Wednesday July 21. Acknowledgement: slides drawn heavily from Kurose & Ross * Based in part on slides by Bechir Hamdaoui and Paul D. Paulson.

2 Chapter 3, slide: 2 rdt2.0 has a fatal flaw! What happens if ACK/NAK is corrupted? That is, sender receives garbled ACK/NAK r sender doesn’t know what happened at receiver! r can’t sender just retransmit?  Sure: sender retransmits current pkt if ACK/NAK garbled  Any problem with this ?? Handling duplicates: r sender adds sequence number to each pkt r receiver discards (doesn’t deliver up) duplicate pkt Sender sends one packet, then waits for receiver response stop and wait Sender sends one packet, then waits for receiver response stop and wait Receiver doesn’t know whether received pkt is a retransmit or a new pkt Problem: duplicate

3 Chapter 3, slide: 3 rdt2.1: sender, handles garbled ACK/NAKs Wait for call 0 from above sndpkt = make_pkt(0, data, checksum) udt_send(sndpkt) rdt_send(data) Wait for ACK or NAK 0 udt_send(sndpkt) rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) || isNAK(rcvpkt) ) sndpkt = make_pkt(1, data, checksum) udt_send(sndpkt) rdt_send(data) rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt) udt_send(sndpkt) rdt_rcv(rcvpkt) && ( corrupt(rcvpkt) || isNAK(rcvpkt) ) rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && isACK(rcvpkt) Wait for call 1 from above Wait for ACK or NAK 1  

4 Chapter 3, slide: 4 rdt2.1: receiver, handles garbled ACK/NAKs Wait for 0 from below sndpkt = make_pkt(NAK, chksum) udt_send(sndpkt) rdt_rcv(rcvpkt) && not corrupt(rcvpkt) && has_seq0(rcvpkt) rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq1(rcvpkt) extract(rcvpkt,data) deliver_data(data) sndpkt = make_pkt(ACK, chksum) udt_send(sndpkt) Wait for 1 from below rdt_rcv(rcvpkt) && notcorrupt(rcvpkt) && has_seq0(rcvpkt) extract(rcvpkt,data) deliver_data(data) sndpkt = make_pkt(ACK, chksum) udt_send(sndpkt) rdt_rcv(rcvpkt) && (corrupt(rcvpkt) sndpkt = make_pkt(ACK, chksum) udt_send(sndpkt) rdt_rcv(rcvpkt) && not corrupt(rcvpkt) && has_seq1(rcvpkt) rdt_rcv(rcvpkt) && (corrupt(rcvpkt) sndpkt = make_pkt(ACK, chksum) udt_send(sndpkt) sndpkt = make_pkt(NAK, chksum) udt_send(sndpkt)

5 Chapter 3, slide: 5 rdt2.1: discussion Sender: r seq # added to pkt r two seq. #’s (0,1) will suffice. Why?  New pkt  Retransmitted pkt r must check if received ACK/NAK corrupted r twice as many states  state must “remember” whether “current” pkt has 0 or 1 seq. # Receiver: r must check if received packet is duplicate  state indicates whether 0 or 1 is expected pkt seq # r note: receiver can not know if its last ACK/NAK received OK at sender

6 Chapter 3, slide: 6 rdt2.2: a NAK-free protocol r do we really need NAKs?? r instead of NAK, receiver sends ACK for last pkt received OK  receiver must explicitly include seq # of pkt being ACKed r duplicate ACK at sender results in same action as NAK: retransmit current pkt r rdt2.2: same functionality as rdt2.1, using ACKs only

7 Chapter 3, slide: 7 rdt3.0: channels with errors and loss New assumption: packet may be lost: underlying channel can also lose packets (data or ACKs) r checksum, seq. #, ACKs, retransmissions will be of help, but not enough r What else is needed? Approach: timeout policy: r sender waits “reasonable” amount of time for ACK r retransmits if no ACK received in this time r if pkt (or ACK) just delayed (not lost):  retransmission will be duplicate, but use of seq. #’s already handles this  receiver must specify seq # of pkt being ACKed r requires countdown timer

8 Chapter 3, slide: 8 rdt3.0 in action ( still stop-n-wait w/ (0,1) sn)

9 Chapter 3, slide: 9 rdt3.0 in action ( still stop-n-wait w/ (0,1) sn) rcv ACK1 do nothing

10 Chapter 3, slide: 10 Performance of rdt3.0: stop-n-wait first packet bit transmitted, t = 0 senderreceiver RTT last packet bit transmitted, t = L / R first packet bit arrives last packet bit arrives, send ACK ACK arrives, send next packet, t = RTT + L / R r rdt3.0 works, but performance stinks r example: R=1 Gbps, 15 ms e-e prop. delay, L=1000Byte packet: T transmit = 8.10 3 b/pkt 10 9 b/sec = 8 microsec L (packet length in bits) R (transmission rate, bps) =

11 Chapter 3, slide: 11 Performance of rdt3.0: stop-n-wait first packet bit transmitted, t = 0 senderreceiver RTT last packet bit transmitted, t = L / R first packet bit arrives last packet bit arrives, send ACK ACK arrives, send next packet, t = RTT + L / R r rdt3.0 works, but performance stinks r example: R=1 Gbps, 15 ms e-e prop. delay, L=1000Byte packet:  U sender : utilization – fraction of time sender busy sending

12 Chapter 3, slide: 12 Performance of rdt3.0: stop-n-wait first packet bit transmitted, t = 0 senderreceiver RTT last packet bit transmitted, t = L / R first packet bit arrives last packet bit arrives, send ACK ACK arrives, send next packet, t = RTT + L / R r rdt3.0 works, but performance stinks r example: R=1 Gbps, 15 ms e-e prop. delay, L=1000Byte packet:  1kB pkt every 30 msec -> 33kB/sec thruput over 1 Gbps link  network protocol limits use of physical resources!

13 Chapter 3, slide: 13 Pipelining: increased utilization first packet bit transmitted, t = 0 senderreceiver RTT last bit transmitted, t = L / R first packet bit arrives last packet bit arrives, send ACK ACK arrives, send next packet, t = RTT + L / R last bit of 2 nd packet arrives, send ACK last bit of 3 rd packet arrives, send ACK Increase utilization by a factor of 3! Question: What is the link utilization U sender

14 Chapter 3, slide: 14 Pipelined protocols Pipelining: sender allows multiple, “in-flight”, yet-to-be-ACK’ed pkts r what about the range of sequence numbers then?? r What about buffering at receiver?? r Two generic forms of pipelined protocols: go-Back-N and selective repeat

15 Go-Back-N: sender Sender: r k-bit seq # in pkt header r “window” of up to N, consecutive unACKed pkts allowed Chapter 3, slide: 15 r ACK(n): ACKs all pkts up to, including seq # n - “cumulative ACK” m may receive duplicate ACKs (see receiver) r timeout(n): retransmit pkt n and all higher seq # pkts in window

16 Chapter 3, slide: 16 GBN: receiver extended FSM ACK-only: always send ACK for correctly-received pkt with highest in-order seq #  may generate duplicate ACKs  need only remember expectedseqnum r out-of-order pkt:  discard (don’t buffer) -> no receiver buffering!  Re-ACK pkt with highest in-order seq # Wait udt_send(sndpkt) default rdt_rcv(rcvpkt) && notcurrupt(rcvpkt) && hasseqnum(rcvpkt,expectedseqnum) extract(rcvpkt,data) deliver_data(data) sndpkt = make_pkt(expectedseqnum,ACK,chksum) udt_send(sndpkt) expectedseqnum++ expectedseqnum=1 sndpkt = make_pkt(expectedseqnum,ACK,chksum) 

17 Chapter 3, slide: 17 GBN in action

18 Chapter 3, slide: 18 Selective Repeat r receiver individually acknowledges all correctly received pkts  buffers pkts, as needed, for eventual in-order delivery to upper layer r sender only resends pkts for which ACK not received  sender timer for each unACKed pkt r sender window  N consecutive seq #’s  again limits seq #s of sent, unACKed pkts

19 Chapter 3, slide: 19 Selective repeat: sender, receiver windows

20 Chapter 3, slide: 20 Selective repeat in action GBN?

21 Chapter 3, slide: 21 Selective repeat: dilemma Example: r seq #’s: 0, 1, 2, 3 r window size=3

22 Chapter 3, slide: 22 Selective repeat: dilemma Example: r seq #’s: 0, 1, 2, 3 r window size=3 r receiver sees no difference in two scenarios! Even though,  (a) is a retransmit pkt  (b) is a new pkt r in (a), receiver incorrectly passes old data as new r Is this a pb in GBN? Why? doesn’t buffer out-of-order Q: what relationship between seq # size and window size to avoid duplication problem??

23 Chapter 3, slide: 23 Chapter 3 outline r 1 Transport-layer services r 2 Multiplexing and demultiplexing r 3 Connectionless transport: UDP r 4 Principles of reliable data transfer r 5 Connection-oriented transport: TCP r 6 Principles of congestion control r 7 TCP congestion control

24 Chapter 3, slide: 24 TCP Round Trip Time (RTT) and Timeout Why need to estimate RTT? r “timeout” and “retransmit” needed to address pkt loss r need to know when to timeout and retransmit Ideal world: r exact RTT is needed Real world: r RTTs change over time bcause  pkts may take different paths  network load changes over time r RTTs can only be estimated Some intuition r What happens if too short: premature timeout  unnecessary retransmissions r What happens if too long:  slow reaction to segment loss

25 Chapter 3, slide: 25 Technique: Exponential Weighted Moving Average (EWMA) EstimatedRTT = (1-  )*EstimatedRTT +  *SampleRTT 0 <  < 1; typical value:  = 0.125 r SampleRTT:  measured time from segment transmission until ACK receipt r current value of RTT r Ignore retransmission r EstimatedRTT:  estimated based on past & present; smoother than SampleRTT r to be used to set timeout period TCP Round Trip Time (RTT) and Timeout

26 Chapter 3, slide: 26 Technique: Exponential Weighted Moving Average (EWMA) EstimatedRTT = (1-  )*EstimatedRTT +  *SampleRTT 0 <  < 1; typical value:  = 0.125 Example Suppose 3 ACKs returned with SampleRTT 1, SampleRTT 2, and SampleRTT 3. Question: What would be EstimatedRTT after receiving the 3ACKs ? Assume that EstimatedRTT 1 = SampleRTT 1 TCP Round Trip Time (RTT) and Timeout

27 Chapter 3, slide: 27 Technique: Exponential Weighted Moving Average (EWMA) EstimatedRTT = (1-  )*EstimatedRTT +  *SampleRTT 0 <  < 1; typical value:  = 0.125 What happens if  is too small (say very close 0):  A sudden, real change in network load does not get reflected in EstimatedRTT fast enough r May lead to under- or overestimation of RTT for a long time What happens if  is too large(say very close 1):  Transient fluctuations/changes in network load affects EstimatedRTT and makes it unstable when it should not r Also leads to under- or overestimation of RTT TCP Round Trip Time (RTT) and Timeout

28 Chapter 3, slide: 28 Example RTT estimation:

29 Chapter 3, slide: 29 Setting the timeout  timeout = EstimtedRTT, any problem with this???  add a “safety margin” to EstimtedRTT  large variation in EstimatedRTT -> larger safety margin r see how much SampleRTT deviates from EstimatedRTT: TimeoutInterval = EstimatedRTT + 4*DevRTT DevRTT = (1-  )*DevRTT +  *|SampleRTT-EstimatedRTT| (typically,  = 0.25) Then set timeout interval: TCP Round Trip Time (RTT) and Timeout


Download ppt "Chapter 3, slide: 1 CS 372 – introduction to computer networks* Thursday July 8 Announcements: r Lab 3 is posted and due is Monday July 19. r Midterm is."

Similar presentations


Ads by Google