CS 457 Lecture 5 Reliable Delivery Part 2 Fall 2011 Stop and Wait - - PowerPoint PPT Presentation
CS 457 Lecture 5 Reliable Delivery Part 2 Fall 2011 Stop and Wait - - PowerPoint PPT Presentation
CS 457 Lecture 5 Reliable Delivery Part 2 Fall 2011 Stop and Wait in Action Stop and Wait In Action (2) How Long Should Sender Wait? Sender sets a timeout to wait for an ACK Too short: wasted retransmissions Too long: excessive
Stop and Wait in Action
Stop and Wait In Action (2)
How Long Should Sender Wait?
- Sender sets a timeout to wait for an ACK
– Too short: wasted retransmissions – Too long: excessive delays when packet lost
- TCP sets timeout as a function of the RTT
– Expect ACK to arrive after an RTT – … plus a fudge factor to account for queuing
- But, how does the sender know the RTT?
– Can estimate the RTT by watching the ACKs – Smooth estimate: keep a running average of the RTT
- EstimatedRTT = a * EstimatedRTT + (1 –a ) *
SampleRTT
– Compute timeout: TimeOut = 2 * EstimatedRTT
Example RTT Estimation
Performance of Stop and Wait
Example: (good test question) 1 Gbps link (1 *10^9 bits/sec), 15 ms propagation delay 8000 bit packet How does stop and wait perform?
Performance of Stop and Wait
T Transmit = 8kb/pkt 10**9 b/s = 8 us
– Utilization = fraction of time sender is busy sending – 1KB packet every 30 ms ->
- nly 33KB/s throughput over 1 Gbps link
U
sender
= .008
30.008
= 0.00027
microsec
L / R RTT + L / R =
L (packet length in bits) R (transmission rate, bps) =
Delay = T Transmit prop queue
T T + +
- +
Delay = 8 us + 15 ms = 15.008 ms
- ignore
Stop-and-Wait Operation
- first bit transmitted, t = 0
- sender
- receiver
- RTT
- last bit transmitted, t = L / R
- first bit arrives
- last bit arrives, send ACK
- ACK arrives, send next
- packet, t = RTT + L / R
U
sender
= .008
30.008
= 0.00027
microsec
L / R RTT + L / R =
Motivation for Sliding Window
- Stop-and-wait is inefficient
– Only one frame is “in flight” at a time – Especially bad when delay-bandwidth product is high
- Another Numerical example
– 1.5 Mbps link with a 45 msec round-trip time (RTT)
- Delay-bandwidth product is 67.5 Kbits (or 8 KBytes)
– But, sender can send at most one packet per RTT
- Assuming a segment size of 1 KB (8 Kbits)
- … leads to 8 Kbits/segment / 45 msec/segment 182
Kbps
- That’s just one-eighth of the 1.5 Mbps link capacity
Sliding Window
- Allow a larger amount of data “in flight”
– Allow sender to get ahead of the receiver – … though not too far ahead
- Sending process
- Receiving process
- Last byte ACKed
- Last byte sent
- TCP
- TCP
- Next byte expected
- Last byte written
- Last byte read
- Last byte received
Pipelined Protocols
Pipelining: sender allows multiple, “in-flight”, yet-to-be-acknowledged packets
– range of sequence numbers must be increased – buffering at sender and/or receiver
- Two generic forms of pipelined protocols:
go-Back-N (GBN) or selective repeat (SR)
Pipelining: Increased Utilization
- first bit transmitted, t = 0
- sender
- receiver
- RTT
- last bit transmitted, t = L / R
- first bit arrives
- last bit arrives, send ACK
- ACK arrives, send next
- packet, t = RTT + L / R
- last bit of 2nd packet arrives, send ACK
- last bit of 3rd packet arrives, send ACK
U
sender
= .024
30.008
= 0.0008
microsecon
3 * L / R RTT + L / R =
- Increase utilization
- by a factor of 3!
Go-Back-N
Sender:
- k-bit seq # in packet header
- “window” of up to N, consecutive unACK’ed pkts allowed
- ACK(n): cumulative ACK
– ACKs all pkts up to and including seq # n
– may receive duplicate ACKs (see receiver)
- timer for each in-flight packet
- timeout(n): retransmit packet n
and all higher seq # packets in window
GBN in action
Selective Repeat
- Receiver individually acknowledges all
correctly received packets
– buffers packets, as needed, for eventual in-order delivery to upper layer
- Sender only resends packets for which ACK
not received
– sender timer for each unACKed packet
- Sender window
– N consecutive seq #’s – again limits seq #s of sent, unACKed packets
Selective Repeat: Sender, Receiver Windows
Selective Repeat
data from above :
- if next available seq # in
window, send packet
timeout(n):
- resend packet n, restart
timer
ACK(n) in [sendbase,sendbase+N]:
- mark packet n as received
- if n smallest unACKed pkt,
advance window base to next unACKed seq #
- sender
- packet n in [rcvbase, rcvbase
+N-1]
- send ACK(n)
- ut-of-order: buffer
- in-order: deliver (also deliver
buffered, in-order packets), advance window to next not- yet-received packet
- packet n in [rcvbase-
N,rcvbase-1]
- ACK(n)
- otherwise:
- ignore
- receiver
Selective Repeat in Action
Selective Repeat and Seq Numbers
Example:
- seq #’s: 0, 1, 2, 3
- window size=3
- receiver sees no
difference in two scenarios!
- incorrectly passes
duplicate data as new in (a) Q: what relationship between seq # size and window size?
What’s Next
- Read Chapter 1 and 2.1-2.7
- Next Lecture Topics from Chapter 2.6 and 2.7
– Ethernet
- A critical topic in networking
- Homework
– Homework Due Thurs
- Project 1