End2End Design – The Internet Architecture David E. Culler CS162 – Operating Systems and Systems Programming Lecture 32.

Slides:



Advertisements
Similar presentations
CSCI 4550/8556 Computer Networks
Advertisements

Transmission Control Protocol (TCP)
Fundamentals of Computer Networks ECE 478/578 Lecture #20: Transmission Control Protocol Instructor: Loukas Lazos Dept of Electrical and Computer Engineering.
OSI 7-Layer Model. Implementation of UDP and TCP CS587x Lecture 2 Department of Computer Science Iowa State University.
© 2007 Cisco Systems, Inc. All rights reserved.Cisco Public 1 Version 4.0 OSI Transport Layer Network Fundamentals – Chapter 4.
EEC-484/584 Computer Networks Lecture 14 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
Computer Communication Digital Communication in the Modern World Transport Layer Multiplexing, UDP
Chapter 3: Transport Layer
Socket Programming.
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
Transport Layer3-1 Transport Layer Our goals: r understand principles behind transport layer services: m multiplexing/demultipl exing m reliable data transfer.
Transport Layer 3-1 Transport Layer r To learn about transport layer protocols in the Internet: m TCP: connection-oriented protocol m Reliability protocol.
Lecture 8 Chapter 3 Transport Layer
Lecture 7 Transport Protocols: UDP, TCP
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.
Some slides are in courtesy of J. Kurose and K. Ross Review of Previous Lecture Electronic Mail: SMTP, POP3, IMAP DNS Socket programming with TCP.
3-1 Transport services and protocols r provide logical communication between app processes running on different hosts r transport protocols run in end.
Transport Layer TCP and UDP IS250 Spring 2010
8-1 Transport Layer Our goals: r understand principles behind transport layer services: m multiplexing/demultipl exing m reliable data transfer m flow.
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:
TRANSPORT LAYER T.Najah Al-Subaie Kingdom of Saudi Arabia Prince Norah bint Abdul Rahman University College of Computer Since and Information System NET331.
1 Transport Layer Computer Networks. 2 Where are we?
Chapter 17 Networking Dave Bremer Otago Polytechnic, N.Z. ©2008, Prentice Hall Operating Systems: Internals and Design Principles, 6/E William Stallings.
Review: –What is AS? –What is the routing algorithm in BGP? –How does it work? –Where is “policy” reflected in BGP (policy based routing)? –Give examples.
IP and Errors IP Best Effort Datagrams can be: –Lost –Delayed –Duplicated –Delivered out of order –Corrupted.
1 Chapter 1 OSI Architecture The OSI 7-layer Model OSI – Open Systems Interconnection.
Data Communications and Computer Networks Chapter 3 CS 3830 Lecture 12 Omar Meqdadi Department of Computer Science and Software Engineering University.
Network LayerII-1 RSC Part III: Transport Layer 1. Basic Concepts Redes y Servicios de Comunicaciones Universidad Carlos III de Madrid These slides are,
TCP : Transmission Control Protocol Computer Network System Sirak Kaewjamnong.
Transport Layer 3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 Part.
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,
Transport Layer3-1 Chapter 3: Transport Layer Our goals: r understand principles behind transport layer services: m multiplexing/demultipl exing m reliable.
Transport Layer1 Ram Dantu (compiled from various text books)
Transport Layer Moving Segments. Transport Layer Protocols Provide a logical communication link between processes running on different hosts as if directly.
Transport Layer 3-1 Chapter 3 Outline r 3.1 Transport-layer services r 3.2 Multiplexing and demultiplexing r 3.3 Connectionless transport: UDP.
Lec 17. 4/2/14 Anthony D. Joseph CS162 ©UCB Spring 2014 CS162 S ECTION 8.
Transport Layer3-1 Chapter 3 Transport Layer Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross Addison-Wesley,
CS/ECE 4381 Concepts Reverse-path forwarding Regular routing protocols compute shortest path tree, so forward multicast packets along “reverse” of this.
Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.
MULTIPLEXING/DEMULTIPLEXING, CONNECTIONLESS TRANSPORT.
OS view of networking – Sockets API (an exercise in planning for the future) David E. Culler CS162 – Operating Systems and Systems Programming Lecture.
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).
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
Chapter 9: Transport Layer
Instructor Materials Chapter 9: Transport Layer
5. End-to-end protocols (part 1)
Introduction of Transport Protocols
Transport Layer Our goals:
Anthony D. Joseph and Ion Stoica
Process-to-Process Delivery:
April 2, 2014 Anthony D. Joseph CS162 Operating Systems and Systems Programming Lecture 17 TCP, Flow Control, Reliability.
Anthony D. Joseph and John Canny
The Transport Layer Reliability
Introduction to Computer Networks
Process-to-Process Delivery: UDP, TCP
Computer Networks Protocols
Presentation transcript:

End2End Design – The Internet Architecture David E. Culler CS162 – Operating Systems and Systems Programming Lecture 32 Nov 12, 2014 Read: end-2-end HW 5: Due today Mid 2: 11/14 Proj 3: due 12/8

The E2E Concept Traditional Engineering Goal: design the infrastructure to meet application requirements –Optimizing for Cost, Reliability, Performance, … Challenge: infrastructure is most costly & difficult to create and evolves most slowly –Applications evolve rapidly, as does technology End-to-end Design Concept –Utilize intelligence at the point of application –Infrastructure need not meet all application requirements directly –Only what the end-points cannot reasonably do themselves »Avoid redundancy, semantic mismatch, … –Enable applications and incorporate technological advance Design for Change! - and specialization –Layers & protocols 11/12/14UCB CS162 Fa14 L32 2

Q1: True _ False _ Protocols specify the syntax and semantics of communication Q2: True _ False _ Protocols specify the implementation Q3: True _ False _ Layering helps to improve application performance Q4: True _ False _ “Best Effort” packet delivery ensures that packets are delivered in order Q5: True _ False _ In p2p systems a node is both a client and a server Q6: True _ False _ TCP ensures that each packet is delivered within a predefined amount of time Review: Protocols 11/12/14UCB CS162 Fa14 L32 3

Q1: True _ False _ Protocols specify the syntax and semantics of communication Q2: True _ False _ Protocols specify the implementation Q3: True _ False _ Layering helps to improve application performance Q4: True _ False _ “Best Effort” packet delivery ensures that packets are delivered in order Q5: True _ False _ In p2p systems a node is both a client and a server Q6: True _ False _ TCP ensures that each packet is delivered within a predefined amount of time Review: Protocols X X X X X X 11/12/14UCB CS162 Fa14 L32 4

The Internet Hourglass Data Link Physical Applications The Hourglass Model Waist There is just one network-layer protocol, IP The “narrow waist” facilitates interoperability SMTPHTTPNTPDNS TCPUDP IP EthernetSONET Transport FiberCopperRadio 11/12/14UCB CS162 Fa14 L32 5

Internet Protocol (IP) Internet Protocol: Internet’s network layer Service it provides: “Best-Effort” Packet Delivery –Tries it’s “best” to deliver packet to its destination –Packets may be lost –Packets may be corrupted –Packets may be delivered out of order source destination IP network Transport Network Datalink Physical Session Present. Application 11/12/14UCB CS162 Fa14 L32 6

Internet Architecture: The Five Layers Lower three layers implemented everywhere Top two layers implemented only at hosts Logically, layers interacts with peer’s corresponding layer Transport Network Datalink Physical Transport Network Datalink Physical Network Datalink Physical Application Host AHost BRouter 11/12/14UCB CS162 Fa14 L32 7

Physical Communication Communication goes down to physical network Then from network peer to peer Then up to relevant layer Transport Network Datalink Physical Transport Network Datalink Physical Network Datalink Physical Application Host AHost BRouter 11/12/14UCB CS162 Fa14 L32 8

Implications of Hourglass Single Internet-layer module (IP): Allows arbitrary networks to interoperate –Any network technology that supports IP can exchange packets Allows applications to function on all networks –Applications that can run on IP can use any network Supports simultaneous innovations above and below IP –But changing IP itself, i.e., IPv6 is very complicated and slow 11/12/14UCB CS162 Fa14 L32 9

Layering: Packets in Envelopes Physical Layer Datalink Layer Trans. Hdr. Net. Hdr. Frame Hdr. Datalink Layer Trans. Hdr. Net. Hdr. Frame Hdr. Data Network Layer Trans. Hdr. Net. Hdr. Network Layer Trans. Hdr. Net. Hdr. Data Transport Layer Trans. Hdr. Transport Layer Trans. Hdr. Data Application Layer Data 11/12/14UCB CS162 Fa14 L32 10

Transport Layer (4) Service: –Provide end-to-end communication between processes –Demultiplexing of communication between hosts –Possible other services: »Reliability in the presence of errors »Timing properties »Rate adaption (flow-control, congestion control) Interface: send message to “specific process” at given destination; local process receives messages sent to it –How are they named? Protocol: port numbers, perhaps implement reliability, flow control, packetization of large messages, framing Prime Examples: TCP and UDP Transport Network Datalink Physical Session Present. Application 11/12/14UCB CS162 Fa14 L32 11

Internet Transport Protocols Datagram service (UDP) –No-frills extension of “best-effort” IP –Multiplexing/Demultiplexing among processes Reliable, in-order delivery (TCP) –Connection set-up & tear-down –Discarding corrupted packets (segments) –Retransmission of lost packets (segments) –Flow control –Congestion control Services not available –Delay and/or bandwidth guarantees –Sessions that survive change-of-IP-address Transport Network Datalink Physical Session Present. Application 11/12/14UCB CS162 Fa14 L32 12

Application Layer (7 - not 5!) Service: any service provided to the end user Interface: depends on the application Protocol: depends on the application Examples: Skype, SMTP ( ), HTTP (Web), Halo, BitTorrent … What happened to layers 5 & 6? –“Session” and “Presentation” layers –Part of OSI architecture, but not Internet architecture –Their functionality is provided by application layer Transport Network Datalink Physical Session Present. Application 11/12/14UCB CS162 Fa14 L32 13

Socket API Base level Network programming interface Socket API TCPUDP IP Application Transport Network 11/12/14UCB CS162 Fa14 L32 14

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 same read()/write()/close() system calls 11/12/14UCB CS162 Fa14 L32 15

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 and flow control Application examples: file transfer, chat, http 11/12/14UCB CS162 Fa14 L32 16

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 11/12/14UCB CS162 Fa14 L32 17

Connecting Communication to Processes 11/12/14UCB CS162 Fa14 L32 18

Recall: Sockets 11/12/14UCB CS162 Fa14 L32 19

Recall: Socket creation and connection File systems provide a collection of permanent objects in structured name space –Processes open, read/write/close them –Files exist independent of the processes Sockets provide a means for processes to communicate (transfer data) to other processes. Creation and connection is more complex Form 2-way pipes between processes –Possibly worlds away 11/12/14UCB CS162 Fa14 L32 20

Recall: Sockets in concept 11/12/14UCB CS162 Fa14 L32 21 Client Server read response Close Client Socket Create Client Socket Connect it to server (host:port) Create Server Socket Bind it to an Address (host:port) Listen for Connection Close Connection Socket Close Server Socket Accept connection read request Connection Socket write request write response

Client Protocol 11/12/14UCB CS162 Fa14 L32 22 char *hostname; int sockfd, portno; struct sockaddr_in serv_addr; struct hostent *server; server = buildServerAddr(&serv_addr, hostname, portno); /* Create a TCP socket */ sockfd = socket(AF_INET, SOCK_STREAM, 0) /* Connect to server on port */ connect(sockfd, (struct sockaddr *) &serv_addr, sizeof(serv_addr) printf("Connected to %s:%d\n",server->h_name, portno); /* Carry out Client-Server protocol */ client(sockfd); /* Clean up on termination */ close(sockfd);

Server Protocol (v1) 11/12/14UCB CS162 Fa14 L32 23 /* Create Socket to receive requests*/ lstnsockfd = socket(AF_INET, SOCK_STREAM, 0); /* Bind socket to port */ bind(lstnsockfd, (struct sockaddr *)&serv_addr,sizeof(serv_addr)); while (1) { /* Listen for incoming connections */ listen(lstnsockfd, MAXQUEUE); /* Accept incoming connection, obtaining a new socket for it */ consockfd = accept(lstnsockfd, (struct sockaddr *) &cli_addr, &clilen); server(consockfd); close(consockfd); } close(lstnsockfd);

Sockets in concept: fork 11/12/14UCB CS162 Fa14 L32 24 Client Server Create Client Socket Connect it to server (host:port) write request read response Close Client Socket Create Server Socket Bind it to an Address (host:port) Listen for Connection Accept connection read request write response Close Connection Socket Close Server Socket Connection Socket child Close Connection Socket Close Listen Socket Parent Wait for child

Server Protocol (v2) 11/12/14UCB CS162 Fa14 L32 25 while (1) { listen(lstnsockfd, MAXQUEUE); consockfd = accept(lstnsockfd, (struct sockaddr *) &cli_addr, &clilen); cpid = fork(); /* new process for connection */ if (cpid > 0) { /* parent process */ close(consockfd); tcpid = wait(&cstatus); } else if (cpid == 0) { /* child process */ close(lstnsockfd); /* let go of listen socket */ server(consockfd); close(consockfd); exit(EXIT_SUCCESS); /* exit child normally */ } close(lstnsockfd);

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 11/12/14UCB CS162 Fa14 L32 26

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 SYN, SeqNum = x Active Open Passive Open connect()listen() time 11/12/14UCB CS162 Fa14 L32 27

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 first byte server will send Client (initiator) Server SYN, SeqNum = x SYN and ACK, SeqNum = y and Ack = x + 1 ACK, Ack = y + 1 Active Open Passive Open connect() listen() accept() allocate buffer space time 11/12/14UCB CS162 Fa14 L32 28

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) 11/12/14UCB CS162 Fa14 L32 29

Close Connection Goal: both sides agree to close the connection 4-way connection tear down FIN FIN ACK FIN FIN ACK Host 1Host 2 Can retransmit FIN ACK if it is lost timeout closed close closed data 11/12/14UCB CS162 Fa14 L32 30

Reliable Transfer Retransmit missing packets –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) 11/12/14UCB CS162 Fa14 L32 31

Detecting Packet Loss? Timeouts –Sender timeouts on not receiving ACK Missing ACKs –Receiver ACKs each packet –Sender 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 it is missing 11/12/14UCB CS162 Fa14 L32 32

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 ACK 1 Time Sender Receiver 1 2 ACK 2 3 RTT RTT = 2*d (if latency is symmetric) RTT = 2*d (if latency is symmetric) d 11/12/14UCB CS162 Fa14 L32 33

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

Stop & Wait w/o Errors Say, RTT = 100ms 1 packet = 1500 bytes Throughput = 1500*8bits/0.1s = 120 Kbps ACK 1 Time Sender Receiver 1 2 ACK 2 3 RTT 11/12/14UCB CS162 Fa14 L32 35

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! ACK 1 Time Sender Receiver 1 2 ACK 2 3 RTT 11/12/14UCB CS162 Fa14 L32 36

Stop & Wait with Errors If a loss wait for a retransmission timeout and retransmit How do you pick the timeout? ACK 1 Time Sender Receiver 1 RTT timeout 1 11/12/14UCB CS162 Fa14 L32 37

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 11/12/14UCB CS162 Fa14 L32 38

Sliding Window w/o Errors Throughput = W*packet_size/RTT Time Window size (W) = 3 packets SenderReceiver 1 {1} 2 {1, 2} 3 {1, 2, 3} 4 {2, 3, 4} 5 {3, 4, 5} Unacked packets in sender’s window Out-o-seq packets in receiver’s window {} 6 {4, 5, 6} {} 11/12/14UCB CS162 Fa14 L32 39

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 = 10 9 bps*80*10 -3 s/(8000b) = 10 4 packets Window size ~ Bandwidth (Capacity), delay (RTT/2) 11/12/14UCB CS162 Fa14 L32 40

Sliding Window with Errors Two approaches –Go-Back-n (GBN) –Selective Repeat (SR) In the absence of errors they behave identically Go-Back-n (GBN) –Transmit up to n unacknowledged packets –If timeout for ACK(k), retransmit k, k+1, … –Typically uses NACKs instead of ACKs »Recall, NACK specifies first in-sequence packet missed by receiver 11/12/14UCB CS162 Fa14 L32 41

GBN Example with Errors Window size (W) = 3 packets Sender Receiver {} 6 {5} {5,6} 4 is missing Timeout Packet {} Why doesn’t sender retransmit packet 4 here? Assume packet 4 lost! Out-o-seq packets in receiver’s window NACK 4 11/12/14UCB CS162 Fa14 L32 42

Selective Repeat (SR) Sender: transmit up to n unacknowledged packets Assume packet k is lost Receiver: indicate packet k is missing (use ACKs) Sender: retransmit packet k 11/12/14UCB CS162 Fa14 L32 43

SR Example with Errors Time SenderReceiver Window size (W) = 3 packets {1} {1, 2} {1, 2, 3} {2, 3, 4} {3, 4, 5} {4, 5, 6} {7} Unacked packets in sender’s window ACK 5 ACK 6 11/12/14UCB CS162 Fa14 L32 44

Summary 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 (General’s Paradox) Reliable transmission –S&W not efficient for links with large capacity (bandwidth) delay product –Sliding window more efficient but more complex Flow Control –OS on sender and receiver manage buffers –Sending rate adjusted according to acks and losses –Receiver drops to slow sender on over-run 11/12/14UCB CS162 Fa14 L32 45