EEC484584 Computer Networks Lecture 14 Wenbing Zhao wenbingieee
EEC-484/584 Computer Networks Lecture 14 Wenbing Zhao wenbing@ieee. org (Part of the slides are based on Drs. Kurose & Ross’s slides for their Computer Networking book, and on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall) Spring Semester 2006 EEC-484/584: Computer Networks
2 Outline • • Quiz#3 results Introduction to transport layer Multiplexing/demultiplexing Sliding window protocols Spring Semester 2006 EEC-484/584: Computer Networks 2
3 EEC 484 • • Max: 98 Min: 83 Average: 90 Q 1 avg: 25 Q 2 avg: 27 Q 3 avg: 10 Q 4 avg: 10 Q 5 avg: 19 Spring Semester 2006 EEC-484/584: Computer Networks 3
4 EEC 584 (TTh) • • Max: 100 Min: 69 Average: 90 Q 1 avg: 27 Q 2 avg: 27 Q 3 avg: 9 Q 4 avg: 9 Q 5 avg: 18 Spring Semester 2006 EEC-484/584: Computer Networks 4
5 EEC 584 (MW) • • Max: 93 Min: 75 Average: 87 Q 1 avg: 26 Q 2 avg: 26 Q 3 avg: 9 Q 4 avg: 10 Q 5 avg: 17 Spring Semester 2006 EEC-484/584: Computer Networks 5
6 Transport Layer Our goals: • understand principles behind transport layer services: – multiplexing/demult iplexing – reliable data transfer – flow control – congestion control Spring Semester 2006 • learn about transport layer protocols in the Internet: – UDP: connectionless transport – TCP: connectionoriented transport – TCP congestion control EEC-484/584: Computer Networks 6
7 Transport vs. Data Link Layer • Similarities: deal with error control, sequencing, flow control • Difference: operating environments Environment of the data link layer Spring Semester 2006 Environment of the transport layer EEC-484/584: Computer Networks 7
8 Transport vs. Network Layer • Network layer: logical communication between hosts • Transport layer: logical communication between processes – Relies on, enhances, network layer services Spring Semester 2006 EEC-484/584: Computer Networks 8
9 Internet Transport-Layer Protocols • Reliable, in-order delivery (TCP) network data link physical al ic network data link physical rt EEC-484/584: Computer Networks network data link physical po – delay guarantees – bandwidth guarantees s an • Services not available: network data link physical tr – no-frills extension of “besteffort” IP d en d- en • Unreliable, unordered delivery: UDP Spring Semester 2006 network data link physical g lo – congestion control – flow control – connection setup application transport network data link physical 9
10 Multiplexing/Demultiplexing Multiplexing at send host: gathering data from multiple sockets, enveloping data with header (later used for demultiplexing) Demultiplexing at rcv host: delivering received segments to correct socket = socket application transport network link = process P 3 P 1 application P 2 transport network P 4 application transport network link physical host 1 Spring Semester 2006 physical host 2 EEC-484/584: Computer Networks physical host 3 10
11 How Demultiplexing Works • Host receives IP datagrams – Each datagram has source IP address, destination IP address – Each datagram carries 1 transport-layer segment – Each segment has source, destination port number • Host uses IP addresses & port numbers to direct segment to appropriate socket Spring Semester 2006 32 bits source port # dest port # other header fields application data (message) TCP/UDP segment format EEC-484/584: Computer Networks 11
12 Principles of Reliable Data Transfer characteristics of unreliable channel will determine complexity of reliable data transfer protocol (rdt) Spring Semester 2006 EEC-484/584: Computer Networks 12
Reliable Data Transfer: Sliding Window Protocols 13 • Recall that we have studies 3 simplex reliable transfer protocols in data link layer • Here we study 3 more realistic protocols – A One-Bit Sliding Window Protocol – A Protocol Using Go Back n – A Protocol Using Selective Repeat Spring Semester 2006 EEC-484/584: Computer Networks 13
14 Sliding Window Protocols • Full-duplex: Use same connection for data in both directions (A B and B A) • Interleave data and ack packets – B piggybacks its ack for A’s packet onto B’s next packet – Savings of header in separate ack packet • If B sends data infrequently, use timeout to determine when B should send ack in separate ack packet Spring Semester 2006 EEC-484/584: Computer Networks 14
15 Sliding Window Protocols • Each packet contains sequence number in ranges 0. . 2 n-1 (for n-bit sequence numbers) • Sending window – list of consecutive sequence numbers of packets that sender is permitted to send 1 st outstanding Last packet sent 0 0 1 2 3 4 5 6 1 1 2 3 4 5 6 7 7 A new packet sent (if send window allows) 0 2 7 0 1 ack 3 2 3 Sent window shrinks when the ack corresponding Sent window enlarges when more packet is sent to the 1 st outstanding packet Is received Spring Semester 2006 EEC-484/584: Computer Networks 15
16 Sliding Window Protocols • When new packet arrives from application layer, it is given next highest sequence number, and upper edge of window is incremented • When ack arrives from receiver, lower edge of window is incremented • Within sending window, packets sent but not acked – Sender must keep those packets for possible retransmission – If max window size = w, need w buffers Spring Semester 2006 EEC-484/584: Computer Networks 16
17 Sliding Window Protocols • Receiving window – list of consecutive sequence numbers of packets that receiver is permitted to accept • When packet with (seq num = lower edge of window) arrives – Packet is passed to higher layer – Ack is generated – Window slid down by 1 (remains same size as was initially) 3 Spring Semester 2006 0 1 2 3 4 5 6 7 EEC-484/584: Computer Networks 17
18 One-Bit Sliding Window Protocol A sliding window of size 1, with a 3 -bit sequence number Initially Spring Semester 2006 After first packet sent After first packet received EEC-484/584: Computer Networks After first ack received 18
19 One-Bit Sliding Window Protocol No duplicate, no omissions, no deadlock, but inefficient Normal case Abnormal case -The notation is (seq, ack, packet number) -An asterisk indicates where a packet is delivered Spring Semester 2006 EEC-484/584: Computer Networks 19
20 Sliding Window Protocols: Pipelining • Problem of one-bit sliding window protocol: – Sender blocks till receives acks • Solution: pipelining – Allow sender to send up to w packets before blocking • With pipelining, if packet in middle is lost or damaged, what to do with the packets following it ? • Solution: two strategies – Go Back n - all the packets following it are discarded – Selective repeat – nack the lost/damaged packet and retransmit that packet Spring Semester 2006 EEC-484/584: Computer Networks 20
21 Pipelining and Error Recovery Go back n: Effective receiver window size is 1 Packets discarded Spring Semester 2006 EEC-484/584: Computer Networks 21
22 Pipelining and Error Recovery Selective repeat Packets buffered Can you think of an alternative to go-back-n and selective-repeat? Spring Semester 2006 EEC-484/584: Computer Networks 22
23 Go Back n • Sender – Stores all packets in output buffer – Must get acks in order in which packets are sent • Receiver – Discards all packets following lost or damaged one • Works well – If transmission errors rare and few retransmissions – If lot of traffic in both directions Spring Semester 2006 EEC-484/584: Computer Networks 23
24 Selective Repeat • Receiver accepts and buffers packets following lost or damaged packets • Both sender and receiver maintain windows – Sender’s window starts at 0, grows to MAX SEQ – Receiver’s window fixed at MAX SEQ • Receiver has buffer reserved for each seq num in its window 0 1 Spring Semester 2006 2 3 4 5 6 7 0 1 2 EEC-484/584: Computer Networks 3 4 5 6 7 24
25 Selective Repeat • When packet arrives, receiver checks if seq num in window • If so and if not already received, this packet is accepted and stored • If all lower numbered packets delivered, this packet is delivered as well 5 0 1 2 3 4 Spring Semester 2006 5 3 6 7 0 1 2 3 4 5 6 7 EEC-484/584: Computer Networks 25
26 Non-Sequential Receive Problem • New range of valid sequence numbers for receiver can overlap old range • Overlap can contain duplicates • Example: n = 3 -bit seq num (8 possible numbers, 0 through 7, back to 0) 0 1 Spring Semester 2006 2 3 4 5 6 7 0 1 2 EEC-484/584: Computer Networks 3 4 5 6 7 26
27 Non-Sequential Receive Problem • Sender sends 0, 1, 2, 3, 4, 5, 6 • Receiver – Receives 0, 1, 2, 3, 4, 5, 6 – Sends ack but ack gets lost – Expects to receive 7, 0, 1, 2, 3, 4, 5 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 Spring Semester 2006 EEC-484/584: Computer Networks 27
28 Non-Sequential Receive Problem • Sender times out, retransmits 0, 1, 2, 3, 4, 5, 6 • Receiver checks 0 is in new window, thinks new 0 because sent ack for old 6, waits for 7 0 1 2 Spring Semester 2006 3 4 5 6 7 0 1 2 3 4 5 6 EEC-484/584: Computer Networks 7 28
29 Non-Sequential Receive Problem • Sender receives ack for 0 -6, sends 7 • Receiver receives 7, delivers 7 and old 0 (as new 0 !) 7 0 1 2 3 4 5 6 7 Spring Semester 2006 EEC-484/584: Computer Networks 29
30 Non-Sequential Receive Problem • The problem is caused by the overlap of sequence number between the new receiving window and the old receiving window 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 Overlap Spring Semester 2006 Overlap EEC-484/584: Computer Networks 30
31 Non-Sequential Receive Problem • Solution: – make sure no overlap when receiver advances its window – Make window size w =1/2 range of seq numbers 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 No Overlap Spring Semester 2006 EEC-484/584: Computer Networks 31
32 Selective Repeat • If no reverse traffic before timer goes off, separate ack is sent • When receiver suspects error, sends NAK back to sender (request for retransmission) • Two circumstances that trigger NAK – Damaged packet arrives – Packet other than expected one arrives, suspect expected one is lost • Receiver sends only one NAK for packet expected Spring Semester 2006 EEC-484/584: Computer Networks 32
33 Spring Semester 2006 EEC-484/584: Computer Networks 33
34 Spring Semester 2006 EEC-484/584: Computer Networks 34
35 Spring Semester 2006 EEC-484/584: Computer Networks 35
36 Spring Semester 2006 EEC-484/584: Computer Networks 36
37 Spring Semester 2006 EEC-484/584: Computer Networks 37
- Slides: 37