Download presentation
Presentation is loading. Please wait.
Published byCarmel Stafford Modified over 8 years ago
1
CSE331: Introduction to Networks and Security Lecture 4 Fall 2002
2
CSE331 Fall 20022 Announcements HW1 is due today HW2 on the web site – due next Friday Project 1 will be handed out next Friday –Form groups of two or three –Mail group members to Aditya achadha@gradient.cis.upenn.edu –If you can’t find a partner, mail Aditya –Groups should be formed before project is handed out
3
CSE331 Fall 20023 Recap Link-layer protocols –Frame transmission –Error detection (CRC)
4
CSE331 Fall 20024 Today: Reliable Transmission Now we can detect errors… What do we do when we find one? Corrupt frames must be discarded. Need to recover these lost frames.
5
CSE331 Fall 20025 Fundamental mechanisms Acknowledgments (ACK) –Small control frame (little data) –When sender gets an ACK, recipient has successfully gotten a frame Timeouts –If sender doesn’t get an ACK after “reasonable” time it retransmits the original General strategy called Automatic Repeat Request (ARQ)
6
CSE331 Fall 20026 Stop-and-Wait Simplest scheme –After transmitting one frame, sender waits for an ACK –If the ACK doesn’t arrive, sender retransmits
7
CSE331 Fall 20027 Stop-and-Wait scenario 1 SenderReceiver Time Timeout frame ACK Everything works
8
CSE331 Fall 20028 Stop-and-Wait scenario 2 SenderReceiver Time Timeout ACK Timeout frame Original frame Lost & Resent
9
CSE331 Fall 20029 Stop-and-Wait scenario 3 SenderReceiver Time Timeout ACK Timeout frame ACK ACK Lost
10
CSE331 Fall 200210 Stop-and-Wait scenario 4 SenderReceiver Time Timeout ACK Timeout frame ACK Timeout too short
11
CSE331 Fall 200211 Sequence numbers SenderReceiver Time Timeout ACK 0 Timeout frame 0 ACK 0 Add a 1-bit sequence number so receiver can detect repeated frames.
12
CSE331 Fall 200212 Stop-and-Wait Inefficient use of link’s capacity Sends 1 frame per RTT Example: –10Mbs Link –16ms RTT –Delay x Bandwidth product is about 20KB –Frame size of 1K yields about 5% link capacity
13
CSE331 Fall 200213 More efficient solution SenderReceiver Time Sender ready to transmit N+1 st frame just as 1 st ACK arrives. N = delay x bandwidth frame size
14
CSE331 Fall 200214 Sliding Window Algorithm Sender assigns a sequence number to each frame: SeqNum –For now, assume SeqNum can grow infinitely Send Window Size (SWS) –Upper bound on # of unacknowledged frames sender can transmit Last ACK Received (LAR) –Sequence number of last ACK Last Frame Sent (LFS)
15
CSE331 Fall 200215 Sender Invariant LFS – LAR SWS Associates timeout with each frame sent –Retransmits if no ACK received before timout When ACK arrives, increase LAR –Means another frame can be sent LARLFS SWS Sender’s frames SeqNum
16
CSE331 Fall 200216 Receiver Receive Window Size (RWS) –Number of out-of-order frames it will accept Largest Acceptable Frame (LAF) Largest Frame Received (LFR) LAF – LFR RWS LFRLAF RWS Receiver’s frames SeqNum
17
CSE331 Fall 200217 Receiver Algorithm When packet numbered SeqNum arrives –If (SeqNum LFR) or (SeqNum > LAF) discard –Else accept the packet Define: SeqNumToAck –Largest unACK’ed sequence # s.t. all earlier frames have been accepted Receiver sends ACK(SeqNumToAck) LFR = SeqNumToAck Laf = LFR + RWS
18
CSE331 Fall 200218 Example Sliding Window Protocol 1234 LAR SWS = RWS = 3 SenderReceiver 1234 LFR Sender begins sending frames 1,2,3 with appropriate timers. 1 2 3
19
CSE331 Fall 200219 Example Sliding Window Protocol 1234 LAR SWS = RWS = 3 SenderReceiver 1234 LFR 1 Receiver gets frame 1 SeqNumToAck = 1 Receiver sends ACK(1) 1 2 3 1 LFR = 1 LAF = LFR + RWS LFR
20
CSE331 Fall 200220 Example Sliding Window Protocol 1234 LAR SWS = RWS = 3 SenderReceiver 12341 1 2 3 1 LFR While ACK(1) is in transit, frame 2 is lost and frame 3 is accepted. 3
21
CSE331 Fall 200221 Example Sliding Window Protocol 1234 LAR SWS = RWS = 3 SenderReceiver 12341 1 2 3 1 LFR SeqNumToAck = 1 Receiver sends another Ack(1) message. 3 1
22
CSE331 Fall 200222 Example Sliding Window Protocol 1234 LAR SWS = RWS = 3 SenderReceiver 12341 1 2 3 1 LFR Sender gets ACK(1). Sets LAR = 1 Increases LFS to 4 3 1
23
CSE331 Fall 200223 Example Sliding Window Protocol 1234 LAR SWS = RWS = 3 SenderReceiver 12341 1 2 3 1 LFR Sender transmits frame 4 and then the timer for frame 2 expires, so it resends. 3 1 4 2
24
CSE331 Fall 200224 Example Sliding Window Protocol 1234 LAR SWS = RWS = 3 SenderReceiver 12341 1 2 3 1 LFR Sender gets ACK(1) again—ignores it. 3 1 4 2 Receiver gets frame 4 SeqNumToAck = 1 Receiver sends ACK(1) 1 4
25
CSE331 Fall 200225 Example Sliding Window Protocol 1234 LAR SWS = RWS = 3 SenderReceiver 12341 1 2 3 1 LFR 3 1 4 2 Receiver gets frame 2 SeqNumToAck = 4 Receiver sends ACK(4) 1 42 LFR = 4 LAF = LFR + RWS 567 4
26
CSE331 Fall 200226 Example Sliding Window Protocol 1234 LAR SWS = RWS = 3 SenderReceiver 12341 1 2 3 1 LFR 3 1 4 2 1 42567 4 Sender gets ACK(1) again—ignores it. Sender gets ACK(4) Sets LAR = 4 Increases LFS 567
27
CSE331 Fall 200227 Variants on Sliding Window Receiver doesn’t transmit redundant ACKs Receiver transmits selective ACKS –ACK indicates exactly which frames have been accepted
28
CSE331 Fall 200228 Window Sizes If RTT x Bandwidth product is known then SWS = RTT x Bandwidth / Framesize Receive window size: –1 = no buffering of out-of-order frames –RWS = SWS buffers as many as can be in flight –Note that RWS > SWS is not sensible
29
CSE331 Fall 200229 Finite Sequence Numbers Recall that for Stop-and-Wait we needed two sequence numbers. How many do we need for Sliding Window? Suppose SWS=RWS –How many sequence numbers should there be? –Is SWS + 1 sufficient?
30
CSE331 Fall 200230 Sufficient MaxSeqNum Frame i’s sequence num is i%MaxSeqNum Assuming SWS = RWS SWS < (MaxSeqNum + 1)/2 Why? –Consider case where all the ACKS are lost. –Suppose SWS = RWS = 3 –MaxSeqNum = 5 (sequence numbers = 0,1,2,3,4) is insufficient
31
CSE331 Fall 200231 Roles of Sliding Window Algorithm Reliable delivery –It provides an efficient retransmission protocol for dealing with errors In-order delivery –The receiver buffers frames and delivers them in sequence number order Flow control –It sends ACKs back to give hints to sender –More sophisticate version could give # of frames the receiver has room for—throttles the sender.
32
CSE331 Fall 200232 Sliding window in practice TCP (Transmission Control Protocol) –Transportation layer protocol –Uses sliding window algorithm –More complex because it’s used in an Internetwork – not over a direct link –Bandwidth x delay not known –Dynamically changes timeouts –Larger buffers for in-order delivery
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.