SlideShare a Scribd company logo
1 of 67
Wrapping Up IP 
+ 
The Transport Layer 
EE 122, Fall 2013 
Sylvia Ratnasamy 
http://inst.eecs.berkeley.edu/~ee122/ 
Material thanks to Ion Stoica, Scott Shenker, Jennifer 
Rexford, Nick McKeown, and many other colleagues
Last Lecture: IP Routers 
1 
2 
N 
1 
2 
N 
Linecards (input) 
Route/Control 
Processor 
Interconnect 
Fabric 
Linecards (output)
Shared Memory (1st Generation) 
Route 
Table 
CPU 
Buffer 
Memory 
Line 
Interface 
MAC 
Line 
Interface 
MAC 
Line 
Interface 
MAC 
Shared Backplane 
Limited by rate of shared memory 
(* Slide by Nick McKeown, Stanford Univ.)
Shared Bus (2nd Generation) 
Route 
Table CPU 
Line 
Card 
Buffer 
Memory 
Line 
Card 
Buffer 
Memory 
MAC 
Line 
Card 
Buffer 
Memory 
MAC 
Fwding 
Cache 
Fwding 
Cache 
Fwding 
Cache 
MAC 
Buffer 
Memory 
Limited by shared bus 
(* Slide by Nick McKeown)
Point-to-Point Switch (3rd Generation) 
Line 
Card 
Local 
Buffer 
Memory 
MAC 
CPU 
Card 
Line 
Card 
Local 
Buffer 
Memory 
MAC 
Switched Backplane 
Fwding 
Table 
Routing 
Table 
Fwding 
Table 
(*Slide by Nick McKeown)
3rd Gen. Router: Switched Interconnects 
© Nick McKeown 2006 
NxR 
This is called an “output queued” switch
3rd Gen. Router: Switched Interconnects 
This is called an “input queued” switch 
© Nick McKeown 2006
Two challenges with input queuing 
1) Need an internal fabric scheduler!
3rd Gen. Router: Switched Interconnects 
© Nick McKeown 2006 
Fabric Scheduler
Two challenges with input queuing 
1) Need an internal fabric scheduler! 
2) Must avoid “head-of-line” blocking
Head of Line Blocking 
HoL blocking limits 
throughput to approximately 
58% of capacity
“Virtual Output Queues”
3rd Gen. Router: Switched Interconnects 
© Nick McKeown 2006 
1 x 
R 
Fabric Scheduler
Reality is more complicated 
 Commercial (high-speed) routers use 
 combination of input and output queuing 
 complex multi-stage switching topologies (Clos, Benes) 
 distributed, multi-stage schedulers (for scalability) 
 We’ll consider one simpler context 
 de-facto architecture for a long time and still used in 
lower-speed routers
Context 
 Crossbar fabric 
 Centralized scheduler 
Input 
ports 
Output ports
Scheduling 
 Goal: run links at full capacity, fairness across inputs 
 Scheduling formulated as finding a matching on a bipartite 
graph 
Input 
ports 
Output 
ports 
 Practical solutions look for a good maximal matching (fast)
The Transport Layer
From Lecture#3: Transport Layer 
 Layer at end-hosts, between the application and 
network layer 
Application Application 
Transport 
Network 
Datalink 
Physical 
Transport 
Network 
Datalink 
Physical 
Network 
Datalink 
Physical 
Router 
Host A Host B
Why a transport layer? 
 IP packets are addressed to a host but end-to-end 
communication is between application 
processes at hosts 
 Need a way to decide which packets go to which 
applications (multiplexing/demultiplexing)
Why a transport layer? 
Application Application 
Transport 
Network 
Datalink 
Physical 
Transport 
Network 
Datalink 
Physical 
Host A Host B
Why a transport layer? 
Application 
Transport 
Network 
Datalink 
Physical 
many application 
processes 
Operating 
System 
Datalink 
Physical 
Host A Host B 
browser 
telnet 
mmedia 
ftp 
browser 
IP 
Drivers 
+NIC
Why a transport layer? 
many application 
processes 
Datalink 
Physical 
Communication 
between processes 
at hosts 
Host A Host B 
browser 
telnet 
mmedia 
ftp 
browser 
IP 
Datalink 
Physical 
telnet 
ftp 
IP 
HTTP 
server 
Transport Transport 
Communication 
between hosts 
(128.4.5.6 162.99.7.56)
Why a transport layer? 
 IP packets are addressed to a host but end-to-end 
communication is between application 
processes at hosts 
 Need a way to decide which packets go to which 
applications (mux/demux) 
 IP provides a weak service model (best-effort) 
 Packets can be corrupted, delayed, dropped, 
reordered, duplicated 
 No guidance on how much traffic to send and when 
 Dealing with this is tedious for application developers
Role of the Transport Layer 
 Communication between application processes 
 Mux and demux from/to application processes 
 Implemented using ports
Role of the Transport Layer 
 Communication between application processes 
 Provide common end-to-end services for app layer 
[optional] 
 Reliable, in-order data delivery 
 Well-paced data delivery 
 too fast may overwhelm the network 
 too slow is not efficient
Role of the Transport Layer 
 Communication between processes 
 Provide common end-to-end services for app layer 
[optional] 
 TCP and UDP are the common transport protocols 
 also SCTP, MTCP, SST, RDP, DCCP, …
Role of the Transport Layer 
 Communication between processes 
 Provide common end-to-end services for app layer 
[optional] 
 TCP and UDP are the common transport protocols 
 UDP is a minimalist, no-frills transport protocol 
 only provides mux/demux capabilities
Role of the Transport Layer 
 Communication between processes 
 Provide common end-to-end services for app layer 
[optional] 
 TCP and UDP are the common transport protocols 
 UDP is a minimalist, no-frills transport protocol 
 TCP is the whole-hog protocol 
 offers apps a reliable, in-order, bytestream abstraction 
 with congestion control 
 but no performance guarantees (delay, bw, etc.)
Role of the Transport Layer 
 Communication between processes 
 mux/demux from and to application processes 
 implemented using ports
Context: Applications and Sockets 
 Socket: software abstraction by which an application 
process exchanges network messages with the (transport 
layer in the) operating system 
 socketID = socket(…, socket.TYPE) 
 socketID.sendto(message, …) 
 socketID.recvfrom(…) 
 will cover in detail after midterm 
 Two important types of sockets 
 UDP socket: TYPE is SOCK_DGRAM 
 TCP socket: TYPE is SOCK_STREAM
Ports 
 Problem: deciding which app (socket) gets which packets 
 Solution: port as a transport layer identifier 
 16 bit identifier 
 OS stores mapping between sockets and ports 
 a packet carries a source and destination port number in its 
transport layer header 
 For UDP ports (SOCK_DGRAM) 
 OS stores (local port, local IP address)  socket 
 For TCP ports (SOCK_STREAM) 
 OS stores (local port, local IP, remote port, remote IP)  socket
4-bit 
Version 
4-bit 
Header 
Length 
8-bit 
Type of Service 
(TOS) 
16-bit Total Length (Bytes) 
16-bit Identification 
3-bit 
Flags 13-bit Fragment Offset 
8-bit Time to 
Live (TTL) 
8-bit Protocol 16-bit Header Checksum 
32-bit Source IP Address 
32-bit Destination IP Address 
Options (if any) 
Payload
4 5 
8-bit 
Type of Service 
(TOS) 
16-bit Total Length (Bytes) 
16-bit Identification 
3-bit 
Flags 13-bit Fragment Offset 
8-bit Time to 
Live (TTL) 
8-bit Protocol 16-bit Header Checksum 
32-bit Source IP Address 
32-bit Destination IP Address 
Payload
4 5 
8-bit 
Type of Service 
(TOS) 
16-bit Total Length (Bytes) 
16-bit Identification 
3-bit 
Flags 13-bit Fragment Offset 
8-bit Time to 
Live (TTL) 
6 = TCP 
17 = UDP 
16-bit Header Checksum 
32-bit Source IP Address 
32-bit Destination IP Address 
Payload
4 5 
8-bit 
Type of Service 
(TOS) 
16-bit Total Length (Bytes) 
16-bit Identification 
3-bit 
Flags 13-bit Fragment Offset 
8-bit Time to 
Live (TTL) 
6 = TCP 
17 = UDP 
16-bit Header Checksum 
32-bit Source IP Address 
32-bit Destination IP Address 
16-bit Source Port 16-bit Destination Port 
More transport header fields …. 
Payload
Recap: Multiplexing and Demultiplexing 
 Host receives IP packets 
 Each IP header has source and destination IP address 
 Each Transport Layer header has source and 
destination port number 
 Host uses IP addresses and port numbers to direct the 
message to appropriate socket
More on Ports 
 Separate 16-bit port address space for UDP and TCP 
 “Well known” ports (0-1023): everyone agrees which 
services run on these ports 
 e.g., ssh:22, http:80 
 helps client know server’s port 
 Ephemeral ports (most 1024-65535): given to clients
UDP: User Datagram Protocol 
 Lightweight communication between processes 
 Avoid overhead and delays of ordered, reliable delivery 
 UDP described in RFC 768 – (1980!) 
 Destination IP address and port to support demultiplexing 
 Optional error checking on the packet contents 
 (checksum field = 0 means “don’t verify checksum”) 
SRC port DST port 
checksum length 
DATA
Why a transport layer? 
 IP packets are addressed to a host but end-to-end 
communication is between application 
processes at hosts 
 Need a way to decide which packets go to which 
applications (mux/demux) 
 IP provides a weak service model (best-effort) 
 Packets can be corrupted, delayed, dropped, 
reordered, duplicated
Announcements 
 The next 2-3 weeks will be the hardest of this 
class 
 Project#1 due; Project #2 out 
 HW#2 out 
 Midterm 
 If you’re struggling, ask for help early ! 
 Attend TA’s extra office hours close to project deadlines
Reliable Transport 
 In a perfect world, reliable transport is easy 
@Sender 
 send packets 
@Receiver 
 wait for packets
Reliable Transport 
 In a perfect world, reliable transport is easy 
 All the bad things best-effort can do 
 a packet is corrupted (bit errors) 
 a packet is lost 
 a packet is delayed (why?) 
 packets are reordered (why?) 
 a packet is duplicated (why?)
Dealing with Packet Corruption 
Sender Receiver 
Time 
1 
2 
. 
. 
. 
2 
 
 
ack 
nack
Dealing with Packet Corruption 
Sender Receiver 
Time 
1 
1 
 
 
What if the ACK/NACK is corrupted? 
Packet 
#1 or #2? 
2 
Data and ACK packets carry sequence numbers
Dealing with Packet Loss 
Sender Receiver 
Time 
1 
1 
 
Timer-driven loss detection 
Set timer when packet is sent; retransmit on timeout 
Timeout
Dealing with Packet Loss 
Sender Receiver 
Time 
1 
1 
 
Timeout 
duplicate!
Dealing with Packet Loss 
Sender Receiver 
Time 
1 
. 
. 
. 
1 
Timer-driven retx. can lead to duplicates 
Timeout 
duplicate!
Components of a solution (so far) 
 checksums (to detect bit errors) 
 timers (to detect loss) 
 acknowledgements (positive or negative) 
 sequence numbers (to deal with duplicates)
A Solution: “Stop and Wait” 
@Sender 
 send packet(I); (re)set 
timer; wait for ack 
 If (ACK) 
 I++; repeat 
 If (NACK or TIMEOUT) 
 repeat 
@Receiver 
 wait for packet 
 if packet is OK, send ACK 
 else, send NACK 
 repeat 
 We have a correct reliable transport protocol! 
 Probably the world’s most inefficient one…
Stop & Wait is Inefficient 
RTT Inefficient if 
50 
DATA 
ACK 
Sender Receiver 
TRANS << RTT 
TRANS
Sliding Window 
 window = set of adjacent sequence numbers 
 The size of the set is the window size; assume window size is n 
 General idea: send up to n packets at a time 
 Sender can send packets in its window 
 Receiver can accept packets in its window 
 Window of acceptable packets “slides” on successful 
reception/acknowledgement
Sliding Window 
 Let A be the last ack’d packet of sender without gap; then window of 
sender = {A+1, A+2, …, A+n} 
 Let B be the last received packet without gap by receiver, then 
window of receiver = {B+1,…, B+n} 
n 
B 
Received and ACK’d 
Acceptable but not 
yet received 
Cannot be received 
n 
A 
Already ACK’d 
Sent but not ACK’d 
Cannot be sent 
sequence number 
Acknowledgements w/ Sliding Window 
 Two common options 
 cumulative ACKs: ACK carries next in-order sequence 
number that the receiver expects
Cumulative Acknowledgements 
(1) 
 At receiver 
n 
B 
Received and ACK’d 
Acceptable but not 
yet received 
Cannot be received 
 After receiving B+1, B+2 
B n new= B+2 
 Receiver sends ACK(Bnew+1)
Cumulative Acknowledgements 
(2) 
 At receiver 
n 
B 
Received and ACK’d 
Acceptable but not 
yet received 
Cannot be received 
 After receiving B+4, B+5 
B n 
 Receiver sends ACK(B+1)
Acknowledgements w/ Sliding Window 
 Two common options 
 cumulative ACKs: ACK carries next in-order sequence 
number the receiver expects 
 selective ACKs: ACK individually acknowledges 
correctly received packets 
 Selective ACKs offer more precise information 
but require more complicated book-keeping
Sliding Window Protocols 
 Two canonical approaches 
 Go-Back-N 
 Selective Repeat 
 Many variants that differ in implementation details
Go-Back-N (GBN) 
 Sender transmits up to n unacknowledged packets 
 Receiver only accepts packets in order 
 discards out-of-order packets (i.e., packets other than B+1) 
 Receiver uses cumulative acknowledgements 
 i.e., sequence# in ACK = next expected in-order sequence# 
 Sender sets timer for 1st outstanding ack (A+1) 
 If timeout, retransmit A+1, … , A+n
Sliding Window with GBN 
 Let A be the last ack’d packet of sender without gap; then window of 
sender = {A+1, A+2, …, A+n} 
n 
A 
 Let B be the last received packet without gap by receiver, then 
window of receiver = {B+1,…, B+n} 
Already ACK’d 
Sent but not ACK’d 
Cannot be sent 
n 
B 
Received and ACK’d 
Acceptable but not 
yet received 
Cannot be received 
sequence number 
GBN Example w/o Errors 
Sender Window Window size = 3 packets 
Receiver Window 
Sender Receiver 
Time 
{1} 1 
{1, 2} 2 
{1, 2, 3} 3 
{2, 3, 4} 4 
{3, 4, 5} 5 
{4, 5, 6} 6 
. 
. 
. 
. 
. 
.
GBN Example with Errors 
Window size = 3 packets 
1 
2 
3 
4 
5 
Timeout 6 
Packet 4 
45 
6 
Sender Receiver
Selective Repeat (SR) 
 Sender: transmit up to n unacknowledged packets 
 Assume packet k is lost, k+1 is not 
 Receiver: indicates packet k+1 correctly received 
 Sender: retransmit only packet k on timeout 
 Efficient in retransmissions but complex book-keeping 
 need a timer per packet
SR Example with Errors 
Time 
1 
2 
3 
4 
5 
6 
4 
7 
Window size = 3 packets 
Sender Receiver 
{1} 
{1, 2} 
{1, 2, 3} 
{2, 3, 4} 
{3, 4, 5} 
{4, 5, 6} 
Timeout 
Packet 4 
{4,5,6} 
{4,5,6} 
{7, 8, 9}
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. 
 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 
 Implementation complexity depends on 
protocol details (GBN vs. SR)
Recap: components of a solution 
 Checksums (for error detection) 
 Timers (for loss detection) 
 Acknowledgments 
 cumulative 
 selective 
 Sequence numbers (duplicates, windows) 
 Sliding Windows (for efficiency) 
 Reliability protocols use the above to decide 
when and what to retransmit or acknowledge
What does TCP do? 
Most of our previous tricks + a few differences 
 Sequence numbers are byte offsets 
 Sender and receiver maintain a sliding window 
 Receiver sends cumulative acknowledgements (like GBN) 
 Sender maintains a single retx. timer 
 Receivers do not drop out-of-sequence packets (like SR) 
 Introduces fast retransmit : optimization that uses duplicate 
ACKs to trigger early retx (next time) 
 Introduces timeout estimation algorithms (next time)
Next Time 
 Wrap up reliability in TCP 
 TCP congestion control

More Related Content

What's hot

Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess CommunicationDeepak H L
 
Transport layer (computer networks)
Transport layer (computer networks)Transport layer (computer networks)
Transport layer (computer networks)Fatbardh Hysa
 
Transport Layer Services : Multiplexing And Demultiplexing
Transport Layer Services : Multiplexing And DemultiplexingTransport Layer Services : Multiplexing And Demultiplexing
Transport Layer Services : Multiplexing And DemultiplexingKeyur Vadodariya
 
Transport Layer
Transport LayerTransport Layer
Transport LayerAmin Omi
 
Broadband Network Presentation
Broadband Network PresentationBroadband Network Presentation
Broadband Network PresentationMuhammad Faisal
 
Designing TCP-Friendly Window-based Congestion Control
Designing TCP-Friendly Window-based Congestion ControlDesigning TCP-Friendly Window-based Congestion Control
Designing TCP-Friendly Window-based Congestion Controlsoohyunc
 
Protocol implementation on NS2
Protocol implementation on NS2Protocol implementation on NS2
Protocol implementation on NS2amreshrai02
 
Networking Fundamentals
Networking Fundamentals Networking Fundamentals
Networking Fundamentals Vikas Gupta
 
transport layer
transport layer transport layer
transport layer usman19
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communicationAbDul ThaYyal
 
Chapter 4 slides
Chapter 4 slidesChapter 4 slides
Chapter 4 slideslara_ays
 
A Survey on Cross Layer Routing Protocol with Quality of Service
A Survey on Cross Layer Routing Protocol with Quality of ServiceA Survey on Cross Layer Routing Protocol with Quality of Service
A Survey on Cross Layer Routing Protocol with Quality of ServiceIJSRD
 
Performance Evaluation of Finite Queue Switching Under Two-Dimensional M/G/1...
Performance Evaluation of Finite Queue Switching  Under Two-Dimensional M/G/1...Performance Evaluation of Finite Queue Switching  Under Two-Dimensional M/G/1...
Performance Evaluation of Finite Queue Switching Under Two-Dimensional M/G/1...Syeful Islam
 

What's hot (20)

Interprocess Communication
Interprocess CommunicationInterprocess Communication
Interprocess Communication
 
Transport layer protocol
Transport layer protocolTransport layer protocol
Transport layer protocol
 
Transport layer (computer networks)
Transport layer (computer networks)Transport layer (computer networks)
Transport layer (computer networks)
 
Transport Layer Services : Multiplexing And Demultiplexing
Transport Layer Services : Multiplexing And DemultiplexingTransport Layer Services : Multiplexing And Demultiplexing
Transport Layer Services : Multiplexing And Demultiplexing
 
Transport layer
Transport layer Transport layer
Transport layer
 
Transport layer
Transport layerTransport layer
Transport layer
 
Transport Layer
Transport LayerTransport Layer
Transport Layer
 
Chapter4 Network
Chapter4 NetworkChapter4 Network
Chapter4 Network
 
Broadband Network Presentation
Broadband Network PresentationBroadband Network Presentation
Broadband Network Presentation
 
Chapter3 transport
Chapter3 transportChapter3 transport
Chapter3 transport
 
Ipc
IpcIpc
Ipc
 
Designing TCP-Friendly Window-based Congestion Control
Designing TCP-Friendly Window-based Congestion ControlDesigning TCP-Friendly Window-based Congestion Control
Designing TCP-Friendly Window-based Congestion Control
 
Protocol implementation on NS2
Protocol implementation on NS2Protocol implementation on NS2
Protocol implementation on NS2
 
Transport layer
Transport layerTransport layer
Transport layer
 
Networking Fundamentals
Networking Fundamentals Networking Fundamentals
Networking Fundamentals
 
transport layer
transport layer transport layer
transport layer
 
Chapter 4 a interprocess communication
Chapter 4 a interprocess communicationChapter 4 a interprocess communication
Chapter 4 a interprocess communication
 
Chapter 4 slides
Chapter 4 slidesChapter 4 slides
Chapter 4 slides
 
A Survey on Cross Layer Routing Protocol with Quality of Service
A Survey on Cross Layer Routing Protocol with Quality of ServiceA Survey on Cross Layer Routing Protocol with Quality of Service
A Survey on Cross Layer Routing Protocol with Quality of Service
 
Performance Evaluation of Finite Queue Switching Under Two-Dimensional M/G/1...
Performance Evaluation of Finite Queue Switching  Under Two-Dimensional M/G/1...Performance Evaluation of Finite Queue Switching  Under Two-Dimensional M/G/1...
Performance Evaluation of Finite Queue Switching Under Two-Dimensional M/G/1...
 

Similar to Lec9

OSI model (7 LAYER )
OSI model (7 LAYER )OSI model (7 LAYER )
OSI model (7 LAYER )AAKASH S
 
Lec 4(packet delay layered Architecture)
Lec 4(packet delay layered Architecture)Lec 4(packet delay layered Architecture)
Lec 4(packet delay layered Architecture)maamir farooq
 
DISTIBUTED OPERATING SYSTEM
DISTIBUTED  OPERATING SYSTEM DISTIBUTED  OPERATING SYSTEM
DISTIBUTED OPERATING SYSTEM AjithaG9
 
group11_DNAA:protocol stack and addressing
group11_DNAA:protocol stack and addressinggroup11_DNAA:protocol stack and addressing
group11_DNAA:protocol stack and addressingAnitha Selvan
 
Jaimin chp-6 - transport layer- 2011 batch
Jaimin   chp-6 - transport layer- 2011 batchJaimin   chp-6 - transport layer- 2011 batch
Jaimin chp-6 - transport layer- 2011 batchJaimin Jani
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.pptBlaqray1998
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.pptBlaqray1998
 
FEC & File Multicast
FEC & File MulticastFEC & File Multicast
FEC & File MulticastYoss Cohen
 
Networking Fundamentals
Networking FundamentalsNetworking Fundamentals
Networking FundamentalsUMA MAHESWARI
 
SYBSC IT COMPUTER NETWORKS UNIT I Network Models
SYBSC IT COMPUTER NETWORKS UNIT I Network ModelsSYBSC IT COMPUTER NETWORKS UNIT I Network Models
SYBSC IT COMPUTER NETWORKS UNIT I Network ModelsArti Parab Academics
 
ETE405-lec7.pptx
ETE405-lec7.pptxETE405-lec7.pptx
ETE405-lec7.pptxmashiur
 
TCP-IP Reference Model
TCP-IP Reference ModelTCP-IP Reference Model
TCP-IP Reference ModelMukesh Tekwani
 

Similar to Lec9 (20)

OSI model (7 LAYER )
OSI model (7 LAYER )OSI model (7 LAYER )
OSI model (7 LAYER )
 
Lec 4(packet delay layered Architecture)
Lec 4(packet delay layered Architecture)Lec 4(packet delay layered Architecture)
Lec 4(packet delay layered Architecture)
 
DISTIBUTED OPERATING SYSTEM
DISTIBUTED  OPERATING SYSTEM DISTIBUTED  OPERATING SYSTEM
DISTIBUTED OPERATING SYSTEM
 
group11_DNAA:protocol stack and addressing
group11_DNAA:protocol stack and addressinggroup11_DNAA:protocol stack and addressing
group11_DNAA:protocol stack and addressing
 
Jaimin chp-6 - transport layer- 2011 batch
Jaimin   chp-6 - transport layer- 2011 batchJaimin   chp-6 - transport layer- 2011 batch
Jaimin chp-6 - transport layer- 2011 batch
 
TCP Vs UDP
TCP Vs UDP TCP Vs UDP
TCP Vs UDP
 
01 pengenalan
01 pengenalan01 pengenalan
01 pengenalan
 
OSI Layering
OSI Layering OSI Layering
OSI Layering
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.ppt
 
Chapter_3_Networking.ppt
Chapter_3_Networking.pptChapter_3_Networking.ppt
Chapter_3_Networking.ppt
 
FEC & File Multicast
FEC & File MulticastFEC & File Multicast
FEC & File Multicast
 
Networking Fundamentals
Networking FundamentalsNetworking Fundamentals
Networking Fundamentals
 
TCP Model
TCP ModelTCP Model
TCP Model
 
SYBSC IT COMPUTER NETWORKS UNIT I Network Models
SYBSC IT COMPUTER NETWORKS UNIT I Network ModelsSYBSC IT COMPUTER NETWORKS UNIT I Network Models
SYBSC IT COMPUTER NETWORKS UNIT I Network Models
 
NP-lab-manual (1).pdf
NP-lab-manual (1).pdfNP-lab-manual (1).pdf
NP-lab-manual (1).pdf
 
NP-lab-manual.pdf
NP-lab-manual.pdfNP-lab-manual.pdf
NP-lab-manual.pdf
 
NP-lab-manual.docx
NP-lab-manual.docxNP-lab-manual.docx
NP-lab-manual.docx
 
ETE405-lec7.pptx
ETE405-lec7.pptxETE405-lec7.pptx
ETE405-lec7.pptx
 
Week6 final
Week6 finalWeek6 final
Week6 final
 
TCP-IP Reference Model
TCP-IP Reference ModelTCP-IP Reference Model
TCP-IP Reference Model
 

Recently uploaded

Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGAPNIC
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Onlineanilsa9823
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...tanu pandey
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebJames Anderson
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663Call Girls Mumbai
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024APNIC
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...Diya Sharma
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.soniya singh
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445ruhi
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024APNIC
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝soniya singh
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Servicesexy call girls service in goa
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...Neha Pandey
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)Delhi Call girls
 

Recently uploaded (20)

Networking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOGNetworking in the Penumbra presented by Geoff Huston at NZNOG
Networking in the Penumbra presented by Geoff Huston at NZNOG
 
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Model Towh Delhi 💯Call Us 🔝8264348440🔝
 
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service OnlineCALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
CALL ON ➥8923113531 🔝Call Girls Lucknow Lucknow best sexual service Online
 
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...Nanded City ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready ...
Nanded City ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready ...
 
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark WebGDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
GDG Cloud Southlake 32: Kyle Hettinger: Demystifying the Dark Web
 
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Pratap Nagar Delhi 💯Call Us 🔝8264348440🔝
 
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Ashram Chowk Delhi 💯Call Us 🔝8264348440🔝
 
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
✂️ 👅 Independent Andheri Escorts With Room Vashi Call Girls 💃 9004004663
 
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
DDoS In Oceania and the Pacific, presented by Dave Phelan at NZNOG 2024
 
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
₹5.5k {Cash Payment}New Friends Colony Call Girls In [Delhi NIHARIKA] 🔝|97111...
 
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Sukhdev Vihar Delhi 💯Call Us 🔝8264348440🔝
 
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
Call Now ☎ 8264348440 !! Call Girls in Green Park Escort Service Delhi N.C.R.
 
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
All Time Service Available Call Girls Mg Road 👌 ⏭️ 6378878445
 
On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024On Starlink, presented by Geoff Huston at NZNOG 2024
On Starlink, presented by Geoff Huston at NZNOG 2024
 
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
@9999965857 🫦 Sexy Desi Call Girls Laxmi Nagar 💓 High Profile Escorts Delhi 🫶
 
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
Russian Call Girls in %(+971524965298  )#  Call Girls in DubaiRussian Call Girls in %(+971524965298  )#  Call Girls in Dubai
Russian Call Girls in %(+971524965298 )# Call Girls in Dubai
 
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
Call Girls In Saket Delhi 💯Call Us 🔝8264348440🔝
 
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine ServiceHot Service (+9316020077 ) Goa  Call Girls Real Photos and Genuine Service
Hot Service (+9316020077 ) Goa Call Girls Real Photos and Genuine Service
 
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
𓀤Call On 7877925207 𓀤 Ahmedguda Call Girls Hot Model With Sexy Bhabi Ready Fo...
 
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
WhatsApp 📞 8448380779 ✅Call Girls In Mamura Sector 66 ( Noida)
 

Lec9

  • 1. Wrapping Up IP + The Transport Layer EE 122, Fall 2013 Sylvia Ratnasamy http://inst.eecs.berkeley.edu/~ee122/ Material thanks to Ion Stoica, Scott Shenker, Jennifer Rexford, Nick McKeown, and many other colleagues
  • 2. Last Lecture: IP Routers 1 2 N 1 2 N Linecards (input) Route/Control Processor Interconnect Fabric Linecards (output)
  • 3. Shared Memory (1st Generation) Route Table CPU Buffer Memory Line Interface MAC Line Interface MAC Line Interface MAC Shared Backplane Limited by rate of shared memory (* Slide by Nick McKeown, Stanford Univ.)
  • 4. Shared Bus (2nd Generation) Route Table CPU Line Card Buffer Memory Line Card Buffer Memory MAC Line Card Buffer Memory MAC Fwding Cache Fwding Cache Fwding Cache MAC Buffer Memory Limited by shared bus (* Slide by Nick McKeown)
  • 5. Point-to-Point Switch (3rd Generation) Line Card Local Buffer Memory MAC CPU Card Line Card Local Buffer Memory MAC Switched Backplane Fwding Table Routing Table Fwding Table (*Slide by Nick McKeown)
  • 6. 3rd Gen. Router: Switched Interconnects © Nick McKeown 2006 NxR This is called an “output queued” switch
  • 7. 3rd Gen. Router: Switched Interconnects This is called an “input queued” switch © Nick McKeown 2006
  • 8. Two challenges with input queuing 1) Need an internal fabric scheduler!
  • 9. 3rd Gen. Router: Switched Interconnects © Nick McKeown 2006 Fabric Scheduler
  • 10. Two challenges with input queuing 1) Need an internal fabric scheduler! 2) Must avoid “head-of-line” blocking
  • 11. Head of Line Blocking HoL blocking limits throughput to approximately 58% of capacity
  • 13. 3rd Gen. Router: Switched Interconnects © Nick McKeown 2006 1 x R Fabric Scheduler
  • 14. Reality is more complicated  Commercial (high-speed) routers use  combination of input and output queuing  complex multi-stage switching topologies (Clos, Benes)  distributed, multi-stage schedulers (for scalability)  We’ll consider one simpler context  de-facto architecture for a long time and still used in lower-speed routers
  • 15. Context  Crossbar fabric  Centralized scheduler Input ports Output ports
  • 16. Scheduling  Goal: run links at full capacity, fairness across inputs  Scheduling formulated as finding a matching on a bipartite graph Input ports Output ports  Practical solutions look for a good maximal matching (fast)
  • 18. From Lecture#3: Transport Layer  Layer at end-hosts, between the application and network layer Application Application Transport Network Datalink Physical Transport Network Datalink Physical Network Datalink Physical Router Host A Host B
  • 19. Why a transport layer?  IP packets are addressed to a host but end-to-end communication is between application processes at hosts  Need a way to decide which packets go to which applications (multiplexing/demultiplexing)
  • 20. Why a transport layer? Application Application Transport Network Datalink Physical Transport Network Datalink Physical Host A Host B
  • 21. Why a transport layer? Application Transport Network Datalink Physical many application processes Operating System Datalink Physical Host A Host B browser telnet mmedia ftp browser IP Drivers +NIC
  • 22. Why a transport layer? many application processes Datalink Physical Communication between processes at hosts Host A Host B browser telnet mmedia ftp browser IP Datalink Physical telnet ftp IP HTTP server Transport Transport Communication between hosts (128.4.5.6 162.99.7.56)
  • 23. Why a transport layer?  IP packets are addressed to a host but end-to-end communication is between application processes at hosts  Need a way to decide which packets go to which applications (mux/demux)  IP provides a weak service model (best-effort)  Packets can be corrupted, delayed, dropped, reordered, duplicated  No guidance on how much traffic to send and when  Dealing with this is tedious for application developers
  • 24. Role of the Transport Layer  Communication between application processes  Mux and demux from/to application processes  Implemented using ports
  • 25. Role of the Transport Layer  Communication between application processes  Provide common end-to-end services for app layer [optional]  Reliable, in-order data delivery  Well-paced data delivery  too fast may overwhelm the network  too slow is not efficient
  • 26. Role of the Transport Layer  Communication between processes  Provide common end-to-end services for app layer [optional]  TCP and UDP are the common transport protocols  also SCTP, MTCP, SST, RDP, DCCP, …
  • 27. Role of the Transport Layer  Communication between processes  Provide common end-to-end services for app layer [optional]  TCP and UDP are the common transport protocols  UDP is a minimalist, no-frills transport protocol  only provides mux/demux capabilities
  • 28. Role of the Transport Layer  Communication between processes  Provide common end-to-end services for app layer [optional]  TCP and UDP are the common transport protocols  UDP is a minimalist, no-frills transport protocol  TCP is the whole-hog protocol  offers apps a reliable, in-order, bytestream abstraction  with congestion control  but no performance guarantees (delay, bw, etc.)
  • 29. Role of the Transport Layer  Communication between processes  mux/demux from and to application processes  implemented using ports
  • 30. Context: Applications and Sockets  Socket: software abstraction by which an application process exchanges network messages with the (transport layer in the) operating system  socketID = socket(…, socket.TYPE)  socketID.sendto(message, …)  socketID.recvfrom(…)  will cover in detail after midterm  Two important types of sockets  UDP socket: TYPE is SOCK_DGRAM  TCP socket: TYPE is SOCK_STREAM
  • 31. Ports  Problem: deciding which app (socket) gets which packets  Solution: port as a transport layer identifier  16 bit identifier  OS stores mapping between sockets and ports  a packet carries a source and destination port number in its transport layer header  For UDP ports (SOCK_DGRAM)  OS stores (local port, local IP address)  socket  For TCP ports (SOCK_STREAM)  OS stores (local port, local IP, remote port, remote IP)  socket
  • 32. 4-bit Version 4-bit Header Length 8-bit Type of Service (TOS) 16-bit Total Length (Bytes) 16-bit Identification 3-bit Flags 13-bit Fragment Offset 8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Options (if any) Payload
  • 33. 4 5 8-bit Type of Service (TOS) 16-bit Total Length (Bytes) 16-bit Identification 3-bit Flags 13-bit Fragment Offset 8-bit Time to Live (TTL) 8-bit Protocol 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Payload
  • 34. 4 5 8-bit Type of Service (TOS) 16-bit Total Length (Bytes) 16-bit Identification 3-bit Flags 13-bit Fragment Offset 8-bit Time to Live (TTL) 6 = TCP 17 = UDP 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address Payload
  • 35. 4 5 8-bit Type of Service (TOS) 16-bit Total Length (Bytes) 16-bit Identification 3-bit Flags 13-bit Fragment Offset 8-bit Time to Live (TTL) 6 = TCP 17 = UDP 16-bit Header Checksum 32-bit Source IP Address 32-bit Destination IP Address 16-bit Source Port 16-bit Destination Port More transport header fields …. Payload
  • 36. Recap: Multiplexing and Demultiplexing  Host receives IP packets  Each IP header has source and destination IP address  Each Transport Layer header has source and destination port number  Host uses IP addresses and port numbers to direct the message to appropriate socket
  • 37. More on Ports  Separate 16-bit port address space for UDP and TCP  “Well known” ports (0-1023): everyone agrees which services run on these ports  e.g., ssh:22, http:80  helps client know server’s port  Ephemeral ports (most 1024-65535): given to clients
  • 38. UDP: User Datagram Protocol  Lightweight communication between processes  Avoid overhead and delays of ordered, reliable delivery  UDP described in RFC 768 – (1980!)  Destination IP address and port to support demultiplexing  Optional error checking on the packet contents  (checksum field = 0 means “don’t verify checksum”) SRC port DST port checksum length DATA
  • 39. Why a transport layer?  IP packets are addressed to a host but end-to-end communication is between application processes at hosts  Need a way to decide which packets go to which applications (mux/demux)  IP provides a weak service model (best-effort)  Packets can be corrupted, delayed, dropped, reordered, duplicated
  • 40. Announcements  The next 2-3 weeks will be the hardest of this class  Project#1 due; Project #2 out  HW#2 out  Midterm  If you’re struggling, ask for help early !  Attend TA’s extra office hours close to project deadlines
  • 41. Reliable Transport  In a perfect world, reliable transport is easy @Sender  send packets @Receiver  wait for packets
  • 42. Reliable Transport  In a perfect world, reliable transport is easy  All the bad things best-effort can do  a packet is corrupted (bit errors)  a packet is lost  a packet is delayed (why?)  packets are reordered (why?)  a packet is duplicated (why?)
  • 43. Dealing with Packet Corruption Sender Receiver Time 1 2 . . . 2   ack nack
  • 44. Dealing with Packet Corruption Sender Receiver Time 1 1   What if the ACK/NACK is corrupted? Packet #1 or #2? 2 Data and ACK packets carry sequence numbers
  • 45. Dealing with Packet Loss Sender Receiver Time 1 1  Timer-driven loss detection Set timer when packet is sent; retransmit on timeout Timeout
  • 46. Dealing with Packet Loss Sender Receiver Time 1 1  Timeout duplicate!
  • 47. Dealing with Packet Loss Sender Receiver Time 1 . . . 1 Timer-driven retx. can lead to duplicates Timeout duplicate!
  • 48. Components of a solution (so far)  checksums (to detect bit errors)  timers (to detect loss)  acknowledgements (positive or negative)  sequence numbers (to deal with duplicates)
  • 49. A Solution: “Stop and Wait” @Sender  send packet(I); (re)set timer; wait for ack  If (ACK)  I++; repeat  If (NACK or TIMEOUT)  repeat @Receiver  wait for packet  if packet is OK, send ACK  else, send NACK  repeat  We have a correct reliable transport protocol!  Probably the world’s most inefficient one…
  • 50. Stop & Wait is Inefficient RTT Inefficient if 50 DATA ACK Sender Receiver TRANS << RTT TRANS
  • 51. Sliding Window  window = set of adjacent sequence numbers  The size of the set is the window size; assume window size is n  General idea: send up to n packets at a time  Sender can send packets in its window  Receiver can accept packets in its window  Window of acceptable packets “slides” on successful reception/acknowledgement
  • 52. Sliding Window  Let A be the last ack’d packet of sender without gap; then window of sender = {A+1, A+2, …, A+n}  Let B be the last received packet without gap by receiver, then window of receiver = {B+1,…, B+n} n B Received and ACK’d Acceptable but not yet received Cannot be received n A Already ACK’d Sent but not ACK’d Cannot be sent sequence number 
  • 53. Acknowledgements w/ Sliding Window  Two common options  cumulative ACKs: ACK carries next in-order sequence number that the receiver expects
  • 54. Cumulative Acknowledgements (1)  At receiver n B Received and ACK’d Acceptable but not yet received Cannot be received  After receiving B+1, B+2 B n new= B+2  Receiver sends ACK(Bnew+1)
  • 55. Cumulative Acknowledgements (2)  At receiver n B Received and ACK’d Acceptable but not yet received Cannot be received  After receiving B+4, B+5 B n  Receiver sends ACK(B+1)
  • 56. Acknowledgements w/ Sliding Window  Two common options  cumulative ACKs: ACK carries next in-order sequence number the receiver expects  selective ACKs: ACK individually acknowledges correctly received packets  Selective ACKs offer more precise information but require more complicated book-keeping
  • 57. Sliding Window Protocols  Two canonical approaches  Go-Back-N  Selective Repeat  Many variants that differ in implementation details
  • 58. Go-Back-N (GBN)  Sender transmits up to n unacknowledged packets  Receiver only accepts packets in order  discards out-of-order packets (i.e., packets other than B+1)  Receiver uses cumulative acknowledgements  i.e., sequence# in ACK = next expected in-order sequence#  Sender sets timer for 1st outstanding ack (A+1)  If timeout, retransmit A+1, … , A+n
  • 59. Sliding Window with GBN  Let A be the last ack’d packet of sender without gap; then window of sender = {A+1, A+2, …, A+n} n A  Let B be the last received packet without gap by receiver, then window of receiver = {B+1,…, B+n} Already ACK’d Sent but not ACK’d Cannot be sent n B Received and ACK’d Acceptable but not yet received Cannot be received sequence number 
  • 60. GBN Example w/o Errors Sender Window Window size = 3 packets Receiver Window Sender Receiver Time {1} 1 {1, 2} 2 {1, 2, 3} 3 {2, 3, 4} 4 {3, 4, 5} 5 {4, 5, 6} 6 . . . . . .
  • 61. GBN Example with Errors Window size = 3 packets 1 2 3 4 5 Timeout 6 Packet 4 45 6 Sender Receiver
  • 62. Selective Repeat (SR)  Sender: transmit up to n unacknowledged packets  Assume packet k is lost, k+1 is not  Receiver: indicates packet k+1 correctly received  Sender: retransmit only packet k on timeout  Efficient in retransmissions but complex book-keeping  need a timer per packet
  • 63. SR Example with Errors Time 1 2 3 4 5 6 4 7 Window size = 3 packets Sender Receiver {1} {1, 2} {1, 2, 3} {2, 3, 4} {3, 4, 5} {4, 5, 6} Timeout Packet 4 {4,5,6} {4,5,6} {7, 8, 9}
  • 64. 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.  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  Implementation complexity depends on protocol details (GBN vs. SR)
  • 65. Recap: components of a solution  Checksums (for error detection)  Timers (for loss detection)  Acknowledgments  cumulative  selective  Sequence numbers (duplicates, windows)  Sliding Windows (for efficiency)  Reliability protocols use the above to decide when and what to retransmit or acknowledge
  • 66. What does TCP do? Most of our previous tricks + a few differences  Sequence numbers are byte offsets  Sender and receiver maintain a sliding window  Receiver sends cumulative acknowledgements (like GBN)  Sender maintains a single retx. timer  Receivers do not drop out-of-sequence packets (like SR)  Introduces fast retransmit : optimization that uses duplicate ACKs to trigger early retx (next time)  Introduces timeout estimation algorithms (next time)
  • 67. Next Time  Wrap up reliability in TCP  TCP congestion control