Congestion Control & Optimization Steven Low netlab.CALTECH.edu.
CS/EE 145A Reliable Transmission over Unreliable Channel Netlab.caltech.edu/course.
-
Upload
candace-blankenship -
Category
Documents
-
view
218 -
download
0
Transcript of CS/EE 145A Reliable Transmission over Unreliable Channel Netlab.caltech.edu/course.
CS/EE 145ACS/EE 145AReliable Reliable
Transmission over Transmission over Unreliable Channel Unreliable Channel
Netlab.caltech.edu/courseNetlab.caltech.edu/course
Lab 1Lab 1
Q&A:Q&A: What happens if the udp client cannot What happens if the udp client cannot
receive my message?receive my message? Shall I receive and print the message oShall I receive and print the message o
n the client side?n the client side? I did some extra work…I did some extra work… How do you grade my work?How do you grade my work?
Lab 1Lab 1 Clients:Clients:
Reference Server:l ocal host
Cl i ent Under Test:Local Host
Lab 1Lab 1 Server (Basic Functions):Server (Basic Functions):
Reference Cl i ent:l ocal host
Server Under Test:Local Host
Lab 1Lab 1
Server (Advanced Function 1, Multi-Server (Advanced Function 1, Multi-connection):connection):
ReferenceCl i ent1:l ocal host
Server Under Test:l ogi n. cs
ReferenceCl i ent2:l ocal host
ReferenceCl i ent3:l ogi n.cs
Lab 1Lab 1 Server (Advanced Function 2, 3-connections):Server (Advanced Function 2, 3-connections):
l ocal host
Server Under Test:l ogi n. cs
fast2.cs
fast1.cs
l ogi n.cs
Lab 1: MultiplexingLab 1: Multiplexing
Multiple Processes:Multiple Processes: One process for each active TCP One process for each active TCP
connection, one UDP process and one connection, one UDP process and one Listening processListening process
How to tell the main process when How to tell the main process when the child processes finish the TCP the child processes finish the TCP connection?connection?
SIGCHILD (with a handler in the main SIGCHILD (with a handler in the main function)function)
Lab 1: MultiplexingLab 1: Multiplexing
Multiple Threads:Multiple Threads: Similar to Multiple ProcessesSimilar to Multiple Processes pthread_createpthread_create
Lab 1: MultiplexingLab 1: Multiplexing
Single Process:Single Process: Check status of all ports with a Check status of all ports with a
single “select” functionsingle “select” function Timeout of the “select”?Timeout of the “select”?
Topics of this threadTopics of this thread
How does TCP/IP work? (roughly)How does TCP/IP work? (roughly) Design and implementation of Design and implementation of
protocolsprotocolsApplication (HTTP, FTP, SSH, Application (HTTP, FTP, SSH, SMTP…)SMTP…)
Transportation (TCP)Transportation (TCP)
Networking (IP)Networking (IP)
MAC MAC
Physical Physical
Lab 1
Lab 2, 3, 4
Reliable Transmission over Reliable Transmission over Unreliable Channel (I)Unreliable Channel (I)
TCP:TCP: Reliable Transmission Reliable Transmission
Guarantee: The packets sent will be Guarantee: The packets sent will be received with the same order.received with the same order.
IP:IP: Unreliable Transmission Unreliable Transmission
Best Efforts: Packets can be dropped, can Best Efforts: Packets can be dropped, can be reordered, can be duplicated, can be …be reordered, can be duplicated, can be …
Reliable Transmission over Reliable Transmission over Unreliable Channel (I)Unreliable Channel (I)
TCP:TCP: Reliable Transmission Reliable Transmission
Guarantee: The packets sent will be Guarantee: The packets sent will be received with the same order.received with the same order.
IP:IP: Unreliable Transmission Unreliable Transmission
Best Efforts: Packets can be dropped, can Best Efforts: Packets can be dropped, can be reordered, can be duplicated, can be …be reordered, can be duplicated, can be …
Stream Stream
Reliable Transmission over Reliable Transmission over Unreliable Channel (I)Unreliable Channel (I)
TCP:TCP: Reliable Transmission Reliable Transmission
Guarantee: The packets sent will be Guarantee: The packets sent will be received with the same order.received with the same order.
IP:IP: Unreliable Transmission Unreliable Transmission
Best Efforts: Packets can be dropped, can Best Efforts: Packets can be dropped, can be reordered, can be duplicated, can be …be reordered, can be duplicated, can be …
Stream Stream
P1, P2, … ???
Reliable Transmission over Reliable Transmission over Unreliable Channel: GoalsUnreliable Channel: Goals
We want the file to be transmitted We want the file to be transmitted without any error.without any error.
We cannot make any assumption on We cannot make any assumption on the channel (The packet may be the channel (The packet may be dropped, re-ordered, duplicated… in dropped, re-ordered, duplicated… in the middle).the middle).
We don’t want to waste time.We don’t want to waste time. We don’t want to waste bandwidth.We don’t want to waste bandwidth.
Reliable Transmission over Reliable Transmission over Unreliable Channel: Unreliable Channel:
DifficultiesDifficulties How to split a file into packets?How to split a file into packets? How to detect errors (packet corruption, How to detect errors (packet corruption,
packet loss, duplication, reordering…)?packet loss, duplication, reordering…)? How to recover from packets How to recover from packets
reordering?reordering? How to recover from loss?How to recover from loss? How to use the bandwidth efficiently?How to use the bandwidth efficiently? How to share the bandwidth fairly?How to share the bandwidth fairly? ……
Lab 2Lab 2 How to split a file into packets?How to split a file into packets? How to detect errors (packet corruption, How to detect errors (packet corruption,
packet loss, duplication, reordering…)?packet loss, duplication, reordering…)? How to recover from packets How to recover from packets
reordering?reordering? How to recover from loss?How to recover from loss? How to use the bandwidth efficiently?How to use the bandwidth efficiently? How to share the bandwidth fairly?How to share the bandwidth fairly? ……
Lab 3Lab 3 How to split a file into packets?How to split a file into packets? How to detect errors (packet corruption, How to detect errors (packet corruption,
packet loss, duplication, reordering…)?packet loss, duplication, reordering…)? How to recover from packets How to recover from packets
reordering?reordering? How to recover from loss?How to recover from loss? How to use the bandwidth efficiently?How to use the bandwidth efficiently? How to share the bandwidth fairly?How to share the bandwidth fairly? ……
Lab 4Lab 4 How to split a file into packets?How to split a file into packets? How to detect errors (packet corruption, How to detect errors (packet corruption,
packet loss, duplication, reordering…)?packet loss, duplication, reordering…)? How to recover from packets How to recover from packets
reordering?reordering? How to recover from loss?How to recover from loss? How to use the bandwidth efficiently?How to use the bandwidth efficiently? How to share the bandwidth fairly?How to share the bandwidth fairly? ……
Split a fileSplit a file
File
File
Sender
Receiver
What’s inside
a packet?
Inside a packetInside a packet
DataData HeaderHeader Help to reassemblyHelp to reassembly Help to detect errorsHelp to detect errors
One Example: TCP One Example: TCP HeaderHeader
Source: http://linux-ip.net/gl/tcng/node39.htmlSource: http://linux-ip.net/gl/tcng/node39.html
Detect Packet
Corruption
Packet Identificati
on
Sequence Number Sequence Number (Packet ID)(Packet ID)
1 2 3 4 5 6 7 8
File
1 2 3 4 5 6 7 8
File
Sender
Receiver
In case of packet loss…In case of packet loss…
1 2 3 4 5 6 7 8
File
1 2 4 5 6 7 8
Sender
Receiver
Why?
Please Retransmit: packet 3
In case of packets In case of packets reordering…reordering…
1 2 3 4 5 6 7 8
File
1 2 34 5 6 7 8
Sender
Receiver
Why?
1 2 3 4 5 6 7 8
8
Packet duplicationPacket duplication
1 2 3 4 5 6 7 8
File
1 3 42 5 6 7
Sender
Receiver
2
Why?
1 2 3 4 6 7 85
Sequence Number Sequence Number (Packet ID)(Packet ID)
With the packet ID, the receiver side With the packet ID, the receiver side can recover from packet reordering can recover from packet reordering and packet duplication.and packet duplication.
The receiver can detect packet loss. The receiver can detect packet loss. But it has to call sender for But it has to call sender for retransmission.retransmission.
CS/EE 145A Lab 2CS/EE 145A Lab 2PacketPacket
Netlab.caltech.edu/courseNetlab.caltech.edu/course
Tasks for Lab 2Tasks for Lab 2( Not a network ( Not a network
programming! programming! ) )Assume there is no “packet Assume there is no “packet
corruption”:corruption”: Design a packet format that can be Design a packet format that can be
used to transmit data reliably, over used to transmit data reliably, over unreliable channelsunreliable channels
Implement conversion from a file to Implement conversion from a file to packets, at sender side.packets, at sender side.
Implement error detection and file Implement error detection and file reassembly, at receiver side.reassembly, at receiver side.
Sequence Number Sequence Number (Packet ID)(Packet ID)
1 2 3 4 5 6 7 8
File
1 2 3 4 5 6 7 8
File
Sender
Receiver
SenderSender
sender <filename> <PacketSize>sender <filename> <PacketSize> Read the file specified by <filename> (The fiRead the file specified by <filename> (The fi
le contains English characters and numbers le contains English characters and numbers only)only)
Convert this file into packets, each packet hConvert this file into packets, each packet has at most <PacketSize> bytes, including heaas at most <PacketSize> bytes, including header.der.
Save each packet to one file, with a file namSave each packet to one file, with a file name as “P0000001.txt”, “P0000002.txt”, …e as “P0000001.txt”, “P0000002.txt”, …
ReceiverReceiver
receiver <number of “packets”> <PacketSize> <freceiver <number of “packets”> <PacketSize> <filename>ilename>
Read the files for packets ( “P0000001.txt”, “PRead the files for packets ( “P0000001.txt”, “P0000002.txt”)0000002.txt”)
WARNING: The filenames are always from 1 to WARNING: The filenames are always from 1 to <number of packets>. But packets may not have <number of packets>. But packets may not have the same filenames assigned by the sender, due the same filenames assigned by the sender, due to “packet loss”, “packet reordering” or “pto “packet loss”, “packet reordering” or “packet duplication”.acket duplication”.
Convert the packets into a file, specified by <fileConvert the packets into a file, specified by <filename>. Use one character “#” to indicate eacname>. Use one character “#” to indicate each lost packet. h lost packet.
ExampleExample
File: “abcdefg” File: “abcdefg” Packet Size=10 bytesPacket Size=10 bytesHeader size = 7 bytesHeader size = 7 bytesPayload = 3 bytesPayload = 3 bytesSender: Output 3 files:Sender: Output 3 files:P0000001.txt: <header>+ “abc”P0000001.txt: <header>+ “abc”P0000002.txt: <header>+ “def”P0000002.txt: <header>+ “def”P0000003.txt: <header>+ “g”P0000003.txt: <header>+ “g”
ExampleExample
After “reordering” (by a program writtAfter “reordering” (by a program written by TA):en by TA):
P0000001.txt: <header>+ “abc”P0000001.txt: <header>+ “abc”P0000002.txt: <header>+ “g”P0000002.txt: <header>+ “g”P0000003.txt: <header>+ “def”P0000003.txt: <header>+ “def”Receiver:Receiver:Output a file: “abcdefg”Output a file: “abcdefg”
ExampleExample
After “packet loss” (by a program writtAfter “packet loss” (by a program written by TA):en by TA):
P0000001.txt: <header>+ “g”P0000001.txt: <header>+ “g”P0000002.txt: <header>+ “def”P0000002.txt: <header>+ “def”Receiver:Receiver:Output a file: “#defg”Output a file: “#defg”
TipsTips
For the unknown commands, use For the unknown commands, use “man”/ “info”.“man”/ “info”.
Be careful of the data structuresBe careful of the data structures Testing: design some small Testing: design some small
examples to test your programexamples to test your program Start Earlier!Start Earlier!
Submission (due Submission (due Nov 7Nov 7th th
23:59:59)23:59:59)Task: sender.c; receiver.c; readme.txtTask: sender.c; receiver.c; readme.txtMailto: [email protected] Mailto: [email protected] Documents:Documents: How to use the programs: compile, ruHow to use the programs: compile, ru
n… n… Design, testing cases, the problems yoDesign, testing cases, the problems yo
u metu met Any other commentsAny other comments
GradingGrading
Correctness (70%) Correctness (70%) Documentation and comments (20%)Documentation and comments (20%) Program style (10%)Program style (10%)
TA HoursTA Hours
Tue: 20:00 ~22:00 JRG 170Tue: 20:00 ~22:00 JRG 170 Thu: 20:00 ~22:00 JRG 170Thu: 20:00 ~22:00 JRG 170