Page 1. Goals for Today" Discussion" Example: Reliable File Transfer" CS162 Operating Systems and Systems Programming Lecture 11

Similar documents
Page 1. Goals for Today" Placing Network Functionality" Basic Observation" CS162 Operating Systems and Systems Programming Lecture 15

EE 122: Transport Protocols: UDP and TCP

EE 122: Transport Protocols. Kevin Lai October 16, 2002

Page 1. Goals for Today" What Is A Protocol?" CS162 Operating Systems and Systems Programming Lecture 10. Protocols, Layering and e2e Argument"

EE 122: IP Forwarding and Transport Protocols

Lecture 20 Overview. Last Lecture. This Lecture. Next Lecture. Transport Control Protocol (1) Transport Control Protocol (2) Source: chapters 23, 24

Announcements. No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

CS4700/CS5700 Fundamentals of Computer Networks

NWEN 243. Networked Applications. Layer 4 TCP and UDP

No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

The Transmission Control Protocol (TCP)

CS457 Transport Protocols. CS 457 Fall 2014

Computer Networks. Sándor Laki ELTE-Ericsson Communication Networks Laboratory

TCP Service Model. Today s Lecture. TCP Support for Reliable Delivery. EE 122:TCP, Connection Setup, Reliability

Communication Networks

Lecture 5: Flow Control. CSE 123: Computer Networks Alex C. Snoeren

Announcements. IP Forwarding & Transport Protocols. Goals of Today s Lecture. Are 32-bit Addresses Enough? Summary of IP Addressing.

Outline Computer Networking. Functionality Split. Transport Protocols

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2. Goals for Todayʼs Lecture. Role of Transport Layer

UNIT IV -- TRANSPORT LAYER

CS 43: Computer Networks. 16: Reliable Data Transfer October 8, 2018

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

CS 716: Introduction to communication networks th class; 7 th Oct Instructor: Sridhar Iyer IIT Bombay

Reliable Transport I: Concepts and TCP Protocol

Reliable Transport I: Concepts and TCP Protocol

Announcements Computer Networking. Outline. Transport Protocols. Transport introduction. Error recovery & flow control. Mid-semester grades

ECE697AA Lecture 3. Today s lecture

Guide To TCP/IP, Second Edition UDP Header Source Port Number (16 bits) IP HEADER Protocol Field = 17 Destination Port Number (16 bit) 15 16

Transport Over IP. CSCI 690 Michael Hutt New York Institute of Technology

Transport Layer. Gursharan Singh Tatla. Upendra Sharma. 1

Transport Layer (TCP/UDP)

Question. Reliable Transport: The Prequel. Don t parse my words too carefully. Don t be intimidated. Decisions and Their Principles.

Transport Layer Marcos Vieira

COMP/ELEC 429/556 Introduction to Computer Networks

Chapter 24. Transport-Layer Protocols

OSI Transport Layer. objectives

05 Transmission Control Protocol (TCP)

IS370 Data Communications and Computer Networks. Chapter 5 : Transport Layer

ECE 650 Systems Programming & Engineering. Spring 2018

User Datagram Protocol

Introduction to Networking. Operating Systems In Depth XXVII 1 Copyright 2017 Thomas W. Doeppner. All rights reserved.

Transport layer. UDP: User Datagram Protocol [RFC 768] Review principles: Instantiation in the Internet UDP TCP

CS4700/CS5700 Fundaments of Computer Networks

Transport layer. Review principles: Instantiation in the Internet UDP TCP. Reliable data transfer Flow control Congestion control

Lecture 5. Transport Layer. Transport Layer 1-1

TCP. CSU CS557, Spring 2018 Instructor: Lorenzo De Carli (Slides by Christos Papadopoulos, remixed by Lorenzo De Carli)

c) With the selective repeat protocol, it is possible for the sender to receive an ACK for a packet that falls outside of its current window.

L12: end to end layer

CS 4390 Computer Networks. Transport Services and Protocols

The Transport Layer Multiplexing, Error Detection, & UDP

6.033 Computer System Engineering

TSIN02 - Internetworking

Lecture 3: The Transport Layer: UDP and TCP

CS 268: Internet Architecture & E2E Arguments. Today s Agenda. Scott Shenker and Ion Stoica (Fall, 2010) Design goals.

CSCI-1680 Transport Layer I Rodrigo Fonseca

PLEASE READ CAREFULLY BEFORE YOU START

UDP, TCP, IP multicast

Transport Layer. Application / Transport Interface. Transport Layer Services. Transport Layer Connections

Internet Design Principles

Computer Communication Networks Midterm Review

CS 43: Computer Networks. 18: Transmission Control Protocol October 12-29, 2018

ETSF10 Internet Protocols Transport Layer Protocols

CSC 4900 Computer Networks: TCP

Introduction to Networks and the Internet

Chapter 5 End-to-End Protocols

Programming Assignment 3: Transmission Control Protocol

CMPE 80N: Introduction to Networking and the Internet

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion. Chapter 5 - Part 2

Suprakash Datta. Office: CSEB 3043 Phone: ext Course page:

TCP: Flow and Error Control

Transport Protocols Reading: Sections 2.5, 5.1, and 5.2

Connectionless and Connection-Oriented Protocols OSI Layer 4 Common feature: Multiplexing Using. The Transmission Control Protocol (TCP)

CS 162 Operating Systems and Systems Programming Professor: Anthony D. Joseph Spring Lecture 21: Network Protocols (and 2 Phase Commit)

TSIN02 - Internetworking

End-to-End Protocols. End-to-End Protocols

CCNA R&S: Introduction to Networks. Chapter 7: The Transport Layer

Transport Protocols and TCP

Transport Layer. <protocol, local-addr,local-port,foreign-addr,foreign-port> ϒ Client uses ephemeral ports /10 Joseph Cordina 2005

6.1 Internet Transport Layer Architecture 6.2 UDP (User Datagram Protocol) 6.3 TCP (Transmission Control Protocol) 6. Transport Layer 6-1

Page 1. CS162 Operating Systems and Systems Programming Lecture 22. Networking III. Automatic Repeat Request

CS 640 Introduction to Computer Networks Spring 2009

CSCI-1680 Transport Layer I Rodrigo Fonseca

Intro to LAN/WAN. Transport Layer

ETSF05/ETSF10 Internet Protocols Transport Layer Protocols

Reliable Byte-Stream (TCP)

Chapter 6. What happens at the Transport Layer? Services provided Transport protocols UDP TCP Flow control Congestion control

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 25, 2018

CSCD 330 Network Programming Winter 2015

Lecture (11) OSI layer 4 protocols TCP/UDP protocols

ECE 435 Network Engineering Lecture 9

Networking Technologies and Applications

CS 3640: Introduction to Networks and Their Applications

Chapter 3: Transport Layer Part A

MIDTERM EXAMINATION #2 OPERATING SYSTEM CONCEPTS U N I V E R S I T Y O F W I N D S O R S C H O O L O F C O M P U T E R S C I E N C E

CSC 401 Data and Computer Communications Networks

Applied Networks & Security

Development of reliable protocol Sliding window protocols. C = channel capacity in bps I = interrupt/service time + propagation delay

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP 23.1

Computer and Network Security

Review problems (for no credit): Transport and Network Layer

Transcription:

Goals for Today" CS162 Operating Systems and Systems Programming Lecture 11 Reliability, Transport Protocols" Finish e2e argument & fate sharing Transport: TCP/UDP Reliability Flow control October 5, 2011 Anthony D. Joseph and Ion Stoica http://inst.eecs.berkeley.edu/~cs162 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.2 Example: Reliable File Transfer" Discussion" Host A Appl. Host B Appl. Solution 1 is incomplete What happens if memory is corrupted? Receiver has to do the check anyway OS OK OS Solution 1: make each step reliable, and then concatenate them Solution 2: end-to-end check and try again if necessary 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 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.3 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.4 Page 1

Summary of End-to-End Principle" Conservative Interpretation of E2E" 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 losy link 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 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.5 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.6 Moderate Interpretation" Related Notion of Fate-Sharing Think twice before implementing functionality in the network Idea: when storing state in a distributed system, keep it co-located with the entities that ultimately rely on the state 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 Fate-sharing is a technique for dealing with failure Only way that failure can cause loss of the critical state is if the entity that cares about it also fails... in which case it doesn t matter Often argues for keeping network state at end hosts rather than inside routers In keeping with End-to-End principle E.g., packet-switching rather than circuit-switching E.g., NFS file handles, HTTP cookies 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.7 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.8 Page 2

Background: Definitions" Background: Sending One Packet" Link bandwidth (capacity): maximum rate (in bps) at which the sender can send data along the link Propagation delay: time it takes the signal to travel from source to destination Round Trip Time (RTT): time it takes the signal to travel from source to destination and back Bandwidth: R bps Propaga.on delay: T sec Transmission.me = P/R P bits R bits per second (bps) T seconds T Packet transmission time: time it takes the sender to transmit all bits of the packet 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.9 3me Propaga.on delay =T = Length/speed 1m/speed = 3.3 usec in free space 4 usec in copper 5 usec in fiber 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.10 Sending one Packet: Examples" Reliable Transfer" P = 1 Kbyte R = 1 Gbps 100 Km, fiber => T = 500 usec P/R = 1KB/1Gbps = 8000b/10 9 bps = 10-6 sec = 8 usec 3me T >> P/R T P/R Retransmit missing packets Numbering of packets and ACKs Do this efficiently Keep transmitting whenever possible Detect missing packets and retransmit quickly P = 1 Kbyte R = 100 Mbps 1 Km, fiber => T = 5 usec P/R = 80 usec 3me T << P/R T P/R Two schemes Stop & Wait Sliding Window (Go-back-n and Selective Repeat) 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.11 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.12 Page 3

Detecting Packet Loss?" Timeouts Sender timeouts on not receiving ACK Stop & Wait " Send; wait for ack If timeout, retransmit; else repeat 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 Trans. RTT Sender ACK DATA Receiver Inefficient if Trans. << RTT NACK: Negative ACK Receiver sends a NACK specifying a packet its missing Time 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.13 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.14 Sliding Window" Go-Back-n (GBN)" window = set of adjacent sequence numbers Transmit up to n unacknowledged packets The size of the set is the window size Assume window size is n If timeout for ACK(k), retransmit k, k+1, 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 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.15 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.16 Page 4

GBN Example w/o Errors" GBN Example with Errors" Sender Window {1} {1, 2} {1, 2, 3} {2, 3, 4} {3, 4, 5} {4, 5, 6}... 1 2 3 4 5 6 Sender Window size = 3 packets Receiver Window {} {} {}... Time Receiver Timeout Packet 4 Assume packet 4 1 2 3 4 5 6 4 5 6 lost Sender Window size = 3 packets Why doesnʼt sender retransmit packet 4 here? {} {} {} {5} {5,6} {} Receiver 4 is missing 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.17 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.18 Selective Repeat (SR)" SR Example with Errors" Sender: transmit up to n unacknowledged packets; Assume packet k is lost Receiver: indicate packet k is missing Sender: retransmit packet k {1}" 1" {1, 2}" 2" {1, 2, 3}" 3" {2, 3, 4}" 4" {3, 4, 5}" 5" {4, 5, 6}" 6" {4,5,6}" {7}" 4" 7" Sender" Window size = 3 packets" Nack = 4" Time" Receiver" 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.19 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.20 Page 5

Observations" With sliding windows, it is possible to fully utilize a link, provided the window size is large enough. Throughput is ~ (n/rtt) Stop & Wait is like n = 1. Announcements" Project 1 deadlines: Code: Thursday, October 6, 11:59pm Group evaluations: Friday, October 7, 11:59pm Sender has to buffer all unacknowledged packets, because they may require retransmission Receiver may be able to accept out-of-order packets, but only up to its buffer limits 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.21 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.22 Motivation for Transport Protocols" IP provides a weak, but efficient service model (best-effort) Packets can be delayed, dropped, reordered, duplicated Packets have limited size (why?) 5 Minute Break" Questions Before We Proceed? IP packets are addressed to a host How to decide which application gets which packets? How should hosts send packets into the network? Too fast may overwhelm the network Too slow is not efficient 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.24 Page 6

Transport Layer" Congestion vs. Flow Control" Provide a way to decide which packets go to which applications (multiplexing/demultiplexing) Flow Control avoid overflowing the receiver Congestion Control avoid congesting the network Can Provide reliability, in order delivery, at most once delivery Support messages of arbitrary length Govern when hosts should send data can implement congestion and flow control What is network congestion? 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.25 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.26 Application Transport IP [A B p1 p2 ] Transport Layer (cont d)" HTTP SSH DNS p1 p2 p1 p2 p3 p1 p2 A B C UDP: Not reliable TCP: Ordered, reliable, well-paced ports Ports" Need to decide which applica3on gets which packets Solu3on: map each socket to a port Client must know server s port Separate 16- bit port address space for UDP and TCP (src_ip, src_port, dst_ip, dst_port) uniquely iden3fies TCP connec3on Well known ports (0-1023): everyone agrees which services run on these ports e.g., ssh:22, h_p:80 On UNIX, must be root to gain access to these ports (why?) Ephemeral ports (most 1024-65535): given to clients e.g. chat clients, p2p networks 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.27 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.28 Page 7

Headers" IP header used for IP routing, fragmentation, error detection UDP header used for multiplexing/demultiplexing, error detection TCP header used for multiplexing/demultiplexing, flow and congestion control data" TCP/UDP" data" IP" TCP/UDP" data" Sender" Application" TCP UDP" IP" Receiver" Application" TCP UDP" IP" data" TCP/UDP" data" IP" TCP/UDP" data" UDP: User (Unreliable) Data Protocol" Minimalist transport protocol Same best-effort service model as IP Messages up to 64KB Provides multiplexing/demultiplexing to IP Does not provide flow and congestion control Application examples: video/audio streaming 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.29 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.30 UDP Service & Header" TCP: Transport Control Protocol" Service: Send datagram from (IPa, Port1) to (IPb, Port2) Service is unreliable, but error detection possible Header: 0" 16" 31" Source port" Destination port" UDP length" UDP checksum" Payload (variable)" UDP length is UDP packet length (including UDP header and payload, but not IP header) Optional UDP checksum is over UDP packet 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 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.31 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.32 Page 8

TCP Service" 1) Open connection: 3-way handshaking 2) Reliable byte stream transfer from (IPa, TCP_Port1) to (IPb, TCP_Port2) Indication if connection fails: Reset 3) Close (tear-down) connection Active Open Open Connection: 3-Way Handshaking" Goal: agree on a set of parameters: the start sequence number for each side Starting sequence numbers are random Client (initiator)" connect()" SYN, SeqNum = x" SYN and ACK, SeqNum = y and Ack = x + 1" Server" listen()" accept()" Passive Open ACK, Ack = y + 1" allocate buffer space" 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.33 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.34 3-Way Handshaking (cont d) " Close Connection (Two Generals Problem) " 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) 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? 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.35 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.36 Page 9

Close Connection" 4-ways tear down connection Avoid reincarnation" Can retransmit FIN ACK if it is lost" close" timeout" Host 1" Host 2" FIN ACK" FIN" data" FIN" FIN ACK" close" closed" Summary" Reliable transmission S&W not efficient Go-Back-n What to ACK? (cumulative, ) UDP: Multiplex, detect errors TCP: Reliable Byte Stream 3-way handshaking closed" 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.37 10/5 Anthony D. Joseph and Ion Stoica CS162 UCB Fall 2011 Lec 11.38 Page 10