Computer Communication Networks: Midterm Review
Computer Communication Networks: Midterm Review
Networks
Midterm Review
ICEN/ICSI 416 – Fall 2016
Prof. Dola Saha
1
Instructions
Ø Put your name and student id on each sheet of paper!
Ø The exam is closed book. You cannot use any computer or phone during
the exam. You can use calculator, but not one from your phone or
laptop.
Ø You have 60 minutes to complete the exam. Be a smart exam taker - if
you get stuck on one problem go on to another problem.
Ø The total number of points for each question is given in parenthesis.
There are 100 points total.
Ø Show all your work. Partial credit is possible for an answer, but only if
you show the intermediate steps in obtaining the answer. If you make a
mistake, it will also help the grader show you where you made a
mistake.
2
What is included?
Ø Foundation
Ø Application Layer
Ø Transport Layer
3
Packet Switching vs Circuit Switching
R = 100 Mb/s C
A
D
R = 1.5 Mb/s
B
queue of packets E
waiting for output link
Ø Advantages
Ø Disadvantages
4
Internet Protocol Stack
Ø application: supporting network applications
§ FTP, SMTP, HTTP
application
Ø transport: process-process data transfer
§ TCP, UDP transport
Ø network: routing of datagrams from source
network
to destination
§ IP, routing protocols link
Ø link: data transfer between neighboring
physical
network elements
§ Ethernet, 802.11 (WiFi)
Ø physical: bits “on the wire” / “over the air”
5
Encapsulation
message M application
segment Ht M transport
datagram Hn Ht M network
frame Hl Hn Ht M link
physical
source link
physical
switch
destination
Hn Ht M network
M application Hl Hn Ht M link Hn Ht M
Ht M transport
physical
Hn Ht M network
Hl Hn Ht M link
router
physical
6
Socket
Ø What is a socket?
§ The point where a local application process attaches to the
network
§ An interface between an application and the network
§ An application creates the socket
§ Server side:
o DO NOT specify IP Address
8
Performance
Ø Bandwidth
§ Width of the frequency band
§ Number of bits per second that can be transmitted over a
communication link
§ 1 Mbps: 1 x 106 bits/second = 1x220 bits/sec
Ø Delay
§ Time elapsed for a packet to travel from a sender to receiver
§ seconds
9
Four Sources of Packet Delay
transmission
A propagation
B
nodal
processing queueing
B
nodal
processing queueing
ßACK
12
Performance
Ø Latency = Propagation + processing + transmit + queue
Ø Propagation = distance/speed of light
Ø Transmit = size/bandwidth
Ø Processing = depends on the node (hardware + software), but
fairly constant
Ø Queue = congestion in the node à changes with time
13
Delay X Bandwidth
Ø We think the channel between a pair of processes as a hollow pipe
Ø Latency (delay) length of the pipe and bandwidth the width of the pipe
Ø Delay of 50 ms and bandwidth of 45 Mbps
§ 50 x 10-3 seconds x 45 x 106 bits/second
§ 2.25 x 106 bits = 280 KB data.
Ø Significance
§ This represents the maximum amount of data the sender can send before it would be
possible to receive a response
Network as a pipe
14
Persistent and non-persistent HTTP
non-persistent HTTP issues: persistent HTTP:
Ø requires 2 RTTs per object Ø server leaves connection
Ø OS overhead for each TCP open after sending response
connection Ø subsequent HTTP messages
Ø browsers often open between same client/server
parallel TCP connections to sent over open connection
fetch referenced objects Ø client sends requests as
soon as it encounters a
referenced object
Ø as little as one RTT for all
the referenced objects
15
Digital Audio (1)
Ø ADC (Analog-to-Digital Converter) produces digital audio
from a microphone
§ Telephone: 8000 8-bit samples/second (64 Kbps); computer audio is
usually better quality (e.g., 16 bit)
ADC
16
Digital Video (3)
Ø Step 1: Pixels are mapped to luminance
(brightness)/chrominance (YCbCr) color space
§ Luma signal (Y), Chroma signal: 2 components (Cb and Cr)
§ Chrominance is sub-sampled, the eye is less sensitive to chrominance
Packet
stream
Media
samples
iterated query: 5
§ contacted server replies local DNS server
with name of server to dns.poly.edu
contact 7 6
§ “I don’t know this name, but 1 8
ask this server”
authoritative DNS server
dns.cs.umass.edu
requesting host
cis.poly.edu
gaia.cs.umass.edu 19
Infrastructure Services
Ø Name Resolution
20
BitTorrent: requesting, sending file chunks
requesting chunks: sending chunks: tit-for-tat
§ at any given time, different peers
have different subsets of file § Alice sends chunks to those four peers
currently sending her chunks at
chunks highest rate
§ periodically, Alice asks each peer • other peers are choked by Alice
for list of chunks that they have (do not receive chunks from her)
• re-evaluate top 4 every 10 secs
§ Alice requests missing chunks
from peers, rarest first § every 30 secs: randomly select
another peer, starts sending chunks
• “optimistically unchoke” this
peer
• newly chosen peer may join top 4
21
BitTorrent: tit-for-tat
(1) Alice “optimistically unchokes” Bob
(2) Alice becomes one of Bob’s top-four providers; Bob reciprocates
(3) Bob becomes one of Alice’s top-four providers
22
BitTorrent: another aspect
23
UDP: User Datagram Protocol [RFC 768]
Ø “no frills,” “bare bones” Ø UDP use:
Internet transport § streaming multimedia apps
protocol (loss tolerant, rate sensitive)
§ DNS
Ø “best effort” service, UDP
§ SNMP
segments may be:
• lost
Ø reliable transfer over
• delivered out-of-order to app UDP:
§ add reliability at application
Ø connectionless:
layer
• no handshaking between UDP § application-specific error
sender, receiver recovery!
• each UDP segment handled
independently of others
24
UDP: segment header
length, in bytes of UDP
32 bits segment, including header
source port # dest port #
length checksum
why is there a UDP?
§ no connection establishment
application
data
(which can add delay)
(payload) § simple: no connection state at
sender, receiver
§ small header size
UDP segment format § no congestion control: UDP can
blast away as fast as desired
25
rdt3.0: stop-and-wait operation
sender receiver
first packet bit transmitted, t = 0
last packet bit transmitted, t = L / R
U L/R .008
sender = = = 0.00027
RTT + L / R 30.008
26
Pipelined protocols
pipelining: sender allows multiple, “in-flight”, yet-to-be-
acknowledged pkts
• range of sequence numbers must be increased
• buffering at sender and/or receiver
U 3L / R .0024
sender = = = 0.00081
RTT + L / R 30.008
28
Pipelined protocols: overview
Go-back-N: Selective Repeat:
§ sender can have up to N § sender can have up to N
unacked packets in unack’ed packets in
pipeline pipeline
§ receiver only sends § rcvr sends individual ack
cumulative ack for each packet
• doesn’t ack packet if there’s a
gap
§ sender has timer for § sender maintains timer for
oldest unacked packet each unacked packet
• when timer expires, retransmit • when timer expires, retransmit
only that unacked packet
all unacked packets
29
GBN in action
sender window (N=4) sender receiver
0 1 2 3 45678 send pkt0
0 1 2 3 45678 send pkt1
send pkt2 receive pkt0, send ack0
0 1 2 3 45678
send pkt3 X loss receive pkt1, send ack1
0 1 2 3 45678
(wait)
receive pkt3, discard,
0 1 2 3 4 5 678 rcv ack0, send pkt4 (re)send ack1
0 1 2 3 4 5 678 rcv ack1, send pkt5 receive pkt4, discard,
(re)send ack1
ignore duplicate ACK (ack1) receive pkt5, discard,
(re)send ack1
pkt 2 timeout
01 2 3 4 5 678 send pkt2
01 2 3 4 5 678 send pkt3
01 2 3 4 5 678 send pkt4 rcv pkt2, deliver, send ack2
01 2 3 4 5 678 send pkt5 rcv pkt3, deliver, send ack3
rcv pkt4, deliver, send ack4
rcv pkt5, deliver, send ack5
30
Selective repeat in action
sender window (N=4) sender receiver
0 1 2 3 45678 send pkt0
0 1 2 3 45678 send pkt1
send pkt2 receive pkt0, send ack0
0 1 2 3 45678
send pkt3 X loss receive pkt1, send ack1
0 1 2 3 45678
(wait)
receive pkt3, buffer,
0 1 2 3 4 5 678 rcv ack0, send pkt4 send ack3
0 1 2 3 4 5 678 rcv ack1, send pkt5 receive pkt4, buffer,
send ack4
record ack3 arrived receive pkt5, buffer,
send ack5
pkt 2 timeout
0 1 2 3 4 5 678 send pkt2
0 1 2 3 4 5 678 record ack4 arrived
0 1 2 3 4 5 678 rcv pkt2; deliver pkt2,
record ack5 arrived
0 1 2 3 4 5 678 pkt3, pkt4, pkt5; send ack2
31
TCP segment structure
32 bits
URG: urgent data counting
(generally not used) source port # dest port #
by bytes
sequence number of data
ACK: ACK #
valid acknowledgement number (not segments!)
head not
PSH: push data now len used
UAPR S F receive window
(generally not used) # bytes
checksum Urg data pointer rcvr willing
RST, SYN, FIN: options (variable length) to accept
connection estab
(setup, teardown
commands)
application
Internet data
checksum (variable length)
(as in UDP)
32
TCP seq. numbers, ACKs
outgoing segment from sender
sequence numbers: source port # dest port #
acknowledgement number
A rwnd
checksum urg pointer
33
TCP round trip time, timeout
Q: how to set TCP timeout Q: how to estimate RTT?
value? § SampleRTT: measured time
from segment transmission until
§ longer than RTT ACK receipt
• but RTT varies
• ignore retransmissions
§ too short: premature § SampleRTT will vary, want
timeout, unnecessary estimated RTT “smoother”
retransmissions • average several recent
§ too long: slow reaction to measurements, not just current
segment loss SampleRTT
34
TCP round trip time, timeout
EstimatedRTT = (1- a)*EstimatedRTT + a*SampleRTT
§ exponential weighted moving average
§ influence of past sample decreases exponentially fast
§ typical value: a = 0.125
RTT: gaia.cs.umass.edu to fantasia.eurecom.fr
350
250
RTT (milliseconds)
200
150
sampleRTT
EstimatedRTT
100
1 8 15 22 29 36 43 50 57 64 71 78 85 92 99 106
time (seconds)
time (seconnds)
35
Jacobson/Karels Algorithm
§ timeout interval: EstimatedRTT plus “safety margin”
• large variation in EstimatedRTT -> larger safety margin
§ estimate SampleRTT deviation from EstimatedRTT:
§ RFC 6298
Measure of variability
DevRTT = (1-b)*DevRTT +
b*(|SampleRTT-EstimatedRTT| )
(typically, b = 0.25)
estimated RTT
“safety margin”
36
TCP Reno
80 Slow Start Congestion Avoidance Congestion Avoidance Slow Start
ssthresh = 64
70
Round: Packet #
1: P1
60 ssthresh = cwnd/2 = 36
2: P2, P3
3: P4-P7
Congestion Window Size
40 ssthresh =
cwnd/2 = 26
30 Timeout
20 cwnd =
cwnd/2
10
0
1 6 11 16 21 26 31
Transmission Rounds
37
Good Luck!!!
38