lecture 5: flow control - university of california, san diego€¦ · lecture 5: flow control cse...
TRANSCRIPT
Lecture 5:Flow Control
CSE 123: Computer NetworksAlex C. Snoeren
HW 1 due FRIDAY
Moving up the Stack
2
HTTP
TCP
IP
Ethernetinterface
HTTP
TCP
IP
Ethernetinterface
IP IP
Ethernetinterface
Ethernetinterface
SONETinterface
SONETinterface
host host
router router
Link Layer
Network Layer
Transport Layer
Application Layer
CSE 123 – Lecture 5: Flow Control
Reliable Transmission● The data networking version of the same problem
u How do we reliably send a message when packets can be lost/corrupted in the network?
● Two optionsu Detect a loss/corruption and retransmit
u Send data redundantly to tolerate loss/corruption
3
CSE 123 – Lecture 4: Reliable Transmission
CSE 123 – Lecture 5: Flow Control
Simple Idea: ARQ
● Receiver sends acknowledgments (ACKs)u Sender “times out” and retransmits if it doesn’t receive them
● Basic approach is generically referred to as Automatic Repeat Request(ARQ)
Sender Receiver
Data
ACKTim
e
Tim
eout
Data
ACKTim
eout
T
Data
Sender Receiver
imeo
ut
4
CSE 123 – Lecture 4: Reliable Transmission
CSE 123 – Lecture 5: Flow Control
Not So Fast…
● Loss can occur on ACK channel as wellu Sender cannot distinguish data loss from ACK lossu Sender will retransmit the data frame
● ACK loss—or early timeout—results in duplicationu The receiver thinks the retransmission is new data
Sender Receiver
Data
ACKTim
eout
Data
ACKTim
eout
5
Sender Receiver
Data
ACKTim
eout
Data
ACKTim
eout
Duplicate!
CSE 123 – Lecture 4: Reliable Transmission
CSE 123 – Lecture 5: Flow Control
Duplicate!
Sequence Numbers
● Sequence numbers solve this problemu Receiver can simply ignore duplicate datau But must still send an ACK! (Why?)
● Simplest ARQ: Stop-and-waitu Only one outstanding frame at a time
6
Sender Receiver
Data 0
ACK 0Tim
eout
Data 1
ACK 1Tim
eout
Sender Receiver
Data 0
ACK 0Tim
eout
Data 0
ACK 0Tim
eout Data 1
ACK 1
Ignored!
CSE 123 – Lecture 7: Flow Control
CSE 123 – Lecture 5: Flow Control
How many bits does stop-and-wait need for sequence numbers?
A. 1B. 2C. Depends on timeoutD. I don’t know
Stop-and-Wait Performance
● Lousy performance if time to transmit 1 packet (serialization delay) << time to get to the receiver (propagation delay)u How bad? Depends on round trip time (RTT)
● Want to utilize all available bandwidthu Need to keep more data “in flight”u How much? Called the bandwidth-delay product
● Also limited by quality of timeout (how long?)
7
CSE 123 – Lecture 7: Flow Control
CSE 123 – Lecture 5: Flow Control
How many bits do we want to keep in flight?
A. Bandwidth * one-way delayB. Bandwidth * round-trip delayC. Depends on timeoutD. I don’t know
Pipelined Transmission
● Keep multiple packets “in flight”u Allows sender to make efficient use of the linku Sequence numbers ensure receiver can distinguish frames
● Sender buffers outstanding un-acked packetsu Receiver ACKs the highest consecutive frame received
» ACKs are cumulative (covers current frame and all previous)8
Sender ReceiverData 0
ACK 0
Data 1 Data 2Data 3 ACK 1
ACK 2
ACK 3
Sender ReceiverData 0
ACK 0
Data 1 Data 2Data 3 ACK 1
ACK 1
CSE 123 – Lecture 7: Flow Control
CSE 123 – Lecture 5: Flow Control
Go-Back-N
● Retransmit all packets from point of loss u Packets sent after loss event are ignored (i.e., sent again)
● Simple to implement (receiver doesn’t need to buffer)● Sender controls how much data is “in flight”
9
Sender ReceiverData 0
ACK 0
Data 1 Data 2Data 3 ACK 1
ACK 1
Data 2
Sender ReceiverData 0
ACK 0
Data 1 Data 2Data 3 ACK 1
ACK 3
Data 4
ACK 2
timeo
ut
CSE 123 – Lecture 7: Flow Control
CSE 123 – Lecture 5: Flow Control
Ignored!
Send Window● Bound on number of outstanding packets
u Window “opens” upon receipt of new ACKu Window resets entirely upon a timeout
● Limits amount of wasteu Still lots of duplicatesu We can do better with selective retransmission
10
ACK 1
ACK 0
Data 1
Sender ReceiverData 0
Data 2
Data 2
Tim
eout
Data 3ACK 1
Data 4
ACK 1
Data 3Data 4
Go-Back-N Examplewith window size 3
CSE 123 – Lecture 5: Flow Control
Sliding Window● Single mechanism that supports:
u Multiple outstanding packetsu Reliable deliveryu In-order deliveryu Flow control
● Sender and receiver each maintain “window” abstractions to track outstanding packetsu At the core of all modern ARQ protocols
● Go-Back-N is a special caseu Receive window size of one
11
CSE 123 – Lecture 7: Flow Control
CSE 123 – Lecture 5: Flow Control
Sliding Window – Sender
● Window bounds outstanding unACKed datau Implies need for buffering at sender
● “Last” ACK applies to in-order data● What to do on a timeout?
u Go-Back-N: resend all unacknowledged data on timeoutu Selective Retransmit: timer per packet, resend as needed
≦ Window Size
“Last” ACK Last Sent
… …Sender:
12
CSE 123 – Lecture 7: Flow Control
CSE 123 – Lecture 5: Flow Control
Sliding Window – Receiver
● Receiver buffers too:u data may arrive out-of-orderu or faster than can be consumed
» Flow control: tell sender how much buffer left at receiver● Receiver ACK choices:
u Cumulative, Selective (exempt missing frames), Negative (only missing frames)
Receive Window
“Last” Received Largest Accepted
… …Receiver:
13
CSE 123 – Lecture 7: Flow Control
CSE 123 – Lecture 5: Flow Control
For Next Time
● Read 5-5.1 in P&D
● HW 1 due at the beginning of class Friday
● (Keep) going on the project…
14
CSE 123 – Lecture 7: Flow Control
CSE 123 – Lecture 5: Flow Control