Anthony D. Joseph and Ion Stoica

Slides:



Advertisements
Similar presentations
Introduction 1 Lecture 13 Transport Layer (Transmission Control Protocol) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer.
Advertisements

Umut Girit  One of the core members of the Internet Protocol Suite, the set of network protocols used for the Internet. With UDP, computer.
CSCI 4550/8556 Computer Networks
End2End Design – The Internet Architecture David E. Culler CS162 – Operating Systems and Systems Programming Lecture 32.
Lecture 7 Transport Protocols: UDP, TCP
William Stallings Data and Computer Communications 7 th Edition (Selected slides used for lectures at Bina Nusantara University) Transport Layer.
Department of Electronic Engineering City University of Hong Kong EE3900 Computer Networks Transport Protocols Slide 1 Transport Protocols.
TCP. Learning objectives Reliable Transport in TCP TCP flow and Congestion Control.
3-1 Transport services and protocols r provide logical communication between app processes running on different hosts r transport protocols run in end.
Gursharan Singh Tatla Transport Layer 16-May
What Can IP Do? Deliver datagrams to hosts – The IP address in a datagram header identify a host IP treats a computer as an endpoint of communication Best.
Process-to-Process Delivery:
1 Transport Layer Computer Networks. 2 Where are we?
IP and Errors IP Best Effort Datagrams can be: –Lost –Delayed –Duplicated –Delivered out of order –Corrupted.
CS332, Ch. 26: TCP Victor Norman Calvin College 1.
TCP1 Transmission Control Protocol (TCP). TCP2 Outline Transmission Control Protocol.
The Transport Layer CS168, Fall 2014 Scott Shenker (understudy to Sylvia Ratnasamy) Material thanks to Ion Stoica,
The Transmission Control Protocol (TCP) Application Services (Telnet, FTP, , WWW) Reliable Stream Transport (TCP) Connectionless Packet Delivery.
Transport Layer Moving Segments. Transport Layer Protocols Provide a logical communication link between processes running on different hosts as if directly.
Lec 17. 4/2/14 Anthony D. Joseph CS162 ©UCB Spring 2014 CS162 S ECTION 8.
Transport Protocols.
CS162 Operating Systems and Systems Programming Lecture 15 Reliability, Transport Protocols March 16, 2011 Ion Stoica
4343 X2 – The Transport Layer Tanenbaum Ch.6.
IP1 The Underlying Technologies. What is inside the Internet? Or What are the key underlying technologies that make it work so successfully? –Packet Switching.
CS162 Operating Systems and Systems Programming Lecture 17 TCP, Flow Control, Reliability April 3, 2013 Anthony D. Joseph
TCP Flow Control – an illustration of distributed system thinking David E. Culler CS162 – Operating Systems and Systems Programming
McGraw-Hill Chapter 23 Process-to-Process Delivery: UDP, TCP Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
TCP/IP1 Address Resolution Protocol Internet uses IP address to recognize a computer. But IP address needs to be translated to physical address (NIC).
Transmission Control Protocol (TCP) TCP Flow Control and Congestion Control CS 60008: Internet Architecture and Protocols Department of CSE, IIT Kharagpur.
Computer Networking Lecture 16 – Reliable Transport.
Ch 3. Transport Layer Myungchul Kim
3. END-TO-END PROTOCOLS (PART 1) Rocky K. C. Chang Department of Computing The Hong Kong Polytechnic University 22 March
CS162 Operating Systems and Systems Programming Lecture 11 Reliability, Transport Protocols October 5, 2011 Anthony D. Joseph and Ion Stoica
1 Chapter 24 Internetworking Part 4 (Transport Protocols, UDP and TCP, Protocol Port Numbers)
The Transport Layer Implementation Services Functions Protocols
UDP TCP.
Chapter 9: Transport Layer
09-Transport Layer: TCP Transport Layer.
DMET 602: Networks and Media Lab
Fast Retransmit For sliding windows flow control we waited for a timer to expire before beginning retransmission of a packet TCP uses an additional mechanism.
Chapter 3 outline 3.1 Transport-layer services
Instructor Materials Chapter 9: Transport Layer
The Transport Layer (TCP)
5. End-to-end protocols (part 1)
Process-to-Process Delivery, TCP and UDP protocols
TCP.
Chapter 6: Transport Layer (Part I)
Introduction of Transport Protocols
Transport Layer Unit 5.
Transport Layer Our goals:
Introduction to the Transport Layer
Chapter 23 Introduction To Transport Layer
Process-to-Process Delivery:
E2E Arguments & Project Suggestions (Lecture 4, cs262a)
April 2, 2014 Anthony D. Joseph CS162 Operating Systems and Systems Programming Lecture 17 TCP, Flow Control, Reliability.
Anthony D. Joseph and John Canny
Dr. John P. Abraham Professor UTPA
Dr. John P. Abraham Professor UTPA
Advanced Computer Networks
The Transport Layer De/Multiplexing, Reliability
Transportation Layer.
TCP - Part I Relates to Lab 5. First module on TCP which covers packet format, data transfer, and connection management.
The Transport Layer Reliability
Transport Protocols: TCP Segments, Flow control and Connection Setup
Introduction to Computer Networks
Transport Protocols: TCP Segments, Flow control and Connection Setup
Process-to-Process Delivery: UDP, TCP
Computer Networks Protocols
November 26th, 2018 Prof. Ion Stoica
Transport Layer 9/22/2019.
Presentation transcript:

Anthony D. Joseph and Ion Stoica CS162 Operating Systems and Systems Programming Lecture 17 Reliability, TCP, Flow Control March 21, 2012 Anthony D. Joseph and Ion Stoica http://inst.eecs.berkeley.edu/~cs162

Placing Network Functionality Hugely influential paper: “End-to-End Arguments in System Design” by Saltzer, Reed, and Clark (‘84) “Sacred Text” of the Internet Endless disputes about what it means Everyone cites it as supporting their position

Basic Observation Some types of network functionality can only be correctly implemented end-to-end Reliability, security, etc Because of this, end hosts: Can satisfy the requirement without network’s help Will/must do so, since can’t rely on network’s help Therefore don’t go out of your way to implement them in the network Note: By “network” here we mean network layer

Example: Reliable File Transfer Host A Host B Appl. Appl. OK OS OS Solution 1: make each step reliable, and then concatenate them Solution 2: end-to-end check and try again if necessary

Discussion Solution 1 is incomplete Solution 2 is complete What happens if memory is corrupted? Receiver has to do the check anyway! Solution 2 is complete Full functionality can be entirely implemented at application layer with no need for reliability from lower layers Is there any need to implement reliability at lower layers? Well, it could be more efficient

End-to-End Principle Implementing this functionality in the network: Doesn’t reduce host implementation complexity Does increase network complexity Probably imposes delay and overhead on all applications, even if they don’t need functionality However, implementing in network can enhance performance in some cases E.g., very lossy link

Conservative Interpretation of E2E Don’t implement a function at the lower levels of the system unless it can be completely implemented at this level Unless you can relieve the burden from hosts, don’t bother

Moderate Interpretation Think twice before implementing functionality in the network If hosts can implement functionality correctly, implement it in a lower layer only as a performance enhancement But do so only if it does not impose burden on applications that do not require that functionality This is the interpretation we are using

Summary Layered architecture powerful abstraction for organizing complex networks Internet: 5 layers Physical: send bits Datalink: Connect two hosts on same physical media Network: Connect two hosts in a wide area network Transport: Connect two processes on (remote) hosts Applications: Enable applications running on remote hosts to interact Narrow waist: only one network layer in the Internet Enables the higher layer (Transport and Applications) and lower layers (Datalink and Physical) to evolve indpendently

Summary E2E argument encourages us to keep IP simple If higher layer can implement functionality correctly, implement it in a lower layer only if it improves the performance significantly for application that need that functionality, and it does not impose burden on applications that do not require that functionality

Goals for Today Reliable Transfer & flow control TCP Open connection (3-way handshake) Tear-down connection Flow control

Reliable Transfer Retransmit missing packets Do this efficiently Numbering of packets and ACKs Do this efficiently Keep transmitting whenever possible Detect missing packets and retransmit quickly Two schemes Stop & Wait Sliding Window (Go-back-n and Selective Repeat)

Detecting Packet Loss? Timeouts Missing ACKs NACK: Negative ACK Sender timeouts on not receiving ACK Missing ACKs Sender ACKs each packet Receiver detects a missing packet when seeing a gap in the sequence of ACKs Need to be careful! Packets and acks might be reordered NACK: Negative ACK Receiver sends a NACK specifying a packet its missing

Stop & Wait w/o Errors Send; wait for ack; repeat RTT: Round Trip Time (RTT): time it takes a packet to travel from sender to receiver and back One-way latency (d): one way delay from sender and receiver Sender Receiver 1 RTT d RTT = 2*d (if latency is symmetric) ACK 1 2 RTT ACK 2 3 Time

Stop & Wait w/o Errors How many packets can you send? 1 packet / RTT Throughput: number of bits delivered to receiver per sec Sender Receiver 1 RTT ACK 1 2 RTT ACK 2 3 Time

Stop & Wait w/o Errors Say, RTT = 100ms 1 packet = 1500 bytes Throughput = 1500*8bits/0.1s = 120 Kbps Sender Receiver 1 RTT ACK 1 2 RTT ACK 2 3 Time

Stop & Wait w/o Errors Can be highly inefficient for high capacity links Throughput doesn’t depend on the network capacity  even if capacity is 1Gbps, we can only send 120 Kbps! Sender Receiver 1 RTT ACK 1 2 RTT ACK 2 3 Time

Stop & Wait with Errors If a loss wait for a retransmission timeout and retransmit Ho do you pick the timeout? Sender Receiver 1 RTT timeout ACK 1 1 Time

Sliding Window window = set of adjacent sequence numbers The size of the set is the window size Assume window size is n Let A be the last ack’d packet of sender without gap; then window of sender = {A+1, A+2, …, A+n} Sender can send packets in its window Let B be the last received packet without gap by receiver, then window of receiver = {B+1,…, B+n} Receiver can accept out of sequence, if in window

Sliding Window w/o Errors Sender Window Window size = 3 packets Receiver Window 1 {1} 2 {1, 2} {} 3 {1, 2, 3} {} 4 {2, 3, 4} {} 5 {3, 4, 5} . 6 {4, 5, 6} . Time Sender Receiver

Sliding Window w/o Errors Throughput = W*packet_size/RTT Sender Window Window size (W) = 3 packets Receiver Window 1 {1} 2 {1, 2} {} 3 {1, 2, 3} {} 4 {2, 3, 4} {} 5 {3, 4, 5} . 6 {4, 5, 6} . Time Sender Receiver

Example: Sliding Window w/o Errors Assume Link capacity, C = 1Gbps Latency between end-hosts, RTT = 80ms packet_length = 1000 bytes What is the window size W to match link’s capacity, C? Solution We want Throughput = C Throughput = W*packet_size/RTT C = W*packet_size/RTT W = C*RTT/packet_size = 109bps*80*10-3s/(8000b) = 104 packets Window size ~ Bandwidth (Capacity), delay (RTT/2) product

Sliding Window with Errors Two approaches Go-Back-n (GBN) Selective Repeat (SR) In the absence of errors they behave identically Transmit up to n unacknowledged packets If timeout for ACK(k), retransmit k, k+1, …

GBN Example with Errors Window size = 3 packets 1 2 3 4 5 {} 4 is missing Timeout Packet 4 6 {5} {5,6} 4 5 6 {} Why doesn’t sender retransmit packet 4 here? Assume packet 4 lost! Sender Receiver

Selective Repeat (SR) Sender: transmit up to n unacknowledged packets; Assume packet k is lost Receiver: indicate packet k is missing Sender: retransmit packet k

SR Example with Errors Window size = 3 packets {1} 1 {1, 2} 2 {1, 2, 3} 3 {2, 3, 4} 4 {3, 4, 5} 5 6 {4, 5, 6} Nack = 4 {4,5,6} 4 Time {7} 7 Sender Receiver

Socket API Application Socket API Transport TCP UDP Network IP Network programming interface Application Socket API Transport TCP UDP Network IP

BSD Socket API Created at UC Berkeley (1980s) Most popular network API Ported to various OSes, various languages Windows Winsock, BSD, OS X, Linux, Solaris, … Socket modules in Java, Python, Perl, … Similar to Unix file I/O API In the form of file descriptor (sort of handle). Can share the same read()/write()/close() system calls

TCP: Transport Control Protocol Reliable, in-order, and at most once delivery Stream oriented: messages can be of arbitrary length Provides multiplexing/demultiplexing to IP Provides congestion control and avoidance Application examples: file transfer, chat

TCP Service Open connection: 3-way handshaking Reliable byte stream transfer from (IPa, TCP_Port1) to (IPb, TCP_Port2) Indication if connection fails: Reset Close (tear-down) connection

Open Connection: 3-Way Handshaking Goal: agree on a set of parameters, i.e., the start sequence number for each side Starting sequence number: sequence of first byte in stream Starting sequence numbers are random

Open Connection: 3-Way Handshaking Server waits for new connection calling listen() Sender call connect() passing socket which contains server’s IP address and port number OS sends a special packet (SYN) containing a proposal for first sequence number, x Client (initiator) Server Active Open connect() listen() SYN, SeqNum = x Passive Open

Open Connection: 3-Way Handshaking If it has enough resources, server calls accept() to accept connection, and sends back a SYN ACK packet containing client’s sequence number incremented by one, (x + 1) Why is this needed? A sequence number proposal, y, for the first byte the server will send Client (initiator) Server Active Open connect() listen() SYN, SeqNum = x Passive Open accept() SYN and ACK, SeqNum = y and Ack = x + 1 ACK, Ack = y + 1 allocate buffer space

3-Way Handshaking (cont’d) Three-way handshake adds 1 RTT delay Why? Congestion control: SYN (40 byte) acts as cheap probe Protects against delayed packets from other connection (would confuse receiver)

Close Connection (Two Generals Problem) Goal: both sides agree to close the connection Two-army problem: “Two blue armies need to simultaneously attack the white army to win; otherwise they will be defeated. The blue army can communicate only across the area controlled by the white army which can intercept the messengers.” What is the solution?

Close Connection 4-ways tear down connection FIN FIN ACK data FIN Host 1 Host 2 close FIN FIN ACK data Avoid reincarnation Can retransmit FIN ACK if it is lost close FIN FIN ACK closed timeout closed

Summary Reliable transmission TCP: Reliable Byte Stream S&W not efficient for links with large capacity (bandwidth) delay product Sliding window far more efficient TCP: Reliable Byte Stream Open connection (3-way handshaking) Close connection: no perfect solution; no way for two parties to agree in the presence of arbitrary message losses (Byzantine General problem)