data communication principles - mississippi state …web.cse.msstate.edu/~ramkumar/dcp.pdf · data...
TRANSCRIPT
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Communication Principles
Mahalingam RamkumarMississippi State University, MS
August 17, 2015
Ramkumar CSE 4153 / 6153
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
1 Data Communication ChannelsData Rate of a Communication ChannelTransmission MediaModulationMultiplexing
2 Rate and DelayRepeatersRound Trip Time
3 SwitchingPacket Switching
4 Reliable Data TransferError ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
5 Reliable and Efficient Data TransferSliding Window Protocols
2 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Fundamental Factors
Channel bandwidth H
Signal power S
Noise power N
3 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Channel Capacity R
Achievable bit-rate R
Shannon’s Capacity Limit
R = H log2(1 + S/N) bps. (1)
4 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
S/N in Decibels (dB)
Signal to Noise Ratio (SNR)
Usually expressed in dB
(S/N)dB = 10log10(S/N)
20 dB → S/N = 100;
30 dB → S/N = 1000;
5 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Example
What is the limit on achievable rate R in a channel withbandwidth 1 MHz and SNR 30 dB?
30dB → S/N = 1000
R = 1× 106 × log2(1 + 1000) ≈ 1× 106 × 10 = 10Mbps (2)
To double the rate to 20 Mbps, we can
Double the bandwidth, orincrease SNR to 60 dB (or increase S/N ≈ 1 million)log2(1, 000, 000) ≈ 20
6 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Nyquist Sampling Theorem
Any signal “emerging” from a medium is band-width limited
Bandwidth - H hertz (cycles/sec)
A band-limited signal (limited to H Hz) can be uniquelyreconstructed from discrete samples taken at a rate 2H persecond
7 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Nyquist Capacity
Assume each sample can take V possible values
log2(V ) bits per sample
Nyquist capacity C = 2H log2(V )
No of distinct recognizable values V is determined by noise.
If noise is zero, V →∞, so C →∞Every medium has inherent noise
Even at absolute zero (0 Kelvin).
8 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Transmission Media
Two basic types
Guided
Twisted pairCoaxial cablesFiber opticsMagnetic media
Unguided
9 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Twisted Pair
Telephone cables
Any wire is an antenna!
Twisting substantially reduces interference
Waves from different twists cancel out
Number of twists per cm
Categories 3 (16MHz), 5 (100 MHz), 6 (250), and 7(600)
Ethernet cables
(a) (b)
10 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Coaxial Cables
Up to 1 GHz
Twisted pair cables are catching up!
Better noise immunity than twisted pairs
Used for TV signals, cable TV ...
Copper core
Insulating material
Braided outer conductor
Protective plastic covering
11 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Fiber Optics
Extremely high bandwidth
Single mode and multimode
Single mode fibers can handle upto 50GHz over 100km!
Total internal reflection.
Air/silica boundary
Light sourceSilica
Air
(a) (b)
β1 β2 β3
α1 α2 α3
12 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Fiber vs Copper Wire
Weight vs bandwidth
Cost
Security
13 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Electromagnetic Spectrum
100 102 104 106 108 1010 1012 1014 1016 1018 1020 1022 1024
Radio Microwave Infrared UV X-ray Gamma ray
f (Hz)
Visible light
104 105 106 107 108 109 1010 1011 1012 1013 1014 1015 1016
f (Hz)
Twisted pairCoax
Satellite
TV
Terrestrial microwave
Fiber
optics
MaritimeAM
radioFM
radio
Band LF MF HF VHF UHF SHF EHF THF
14 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Allocation of Spectrum
ITU-R, FCCISM (Industrial, Scientific, Medical) Bands
Freq.
Bandwidth
902 MHz
928 MHz
26 MHz
2.4 GHz
2.4835 GHz
5.735 GHz
5.860 GHz
. . . . . .
. . . . . .83.5 MHz
125 MHz
15 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Satellites
Geo-stationary (about 36,000 km)
Medium Earth Orbit (18,000 km, 6 hr orbits)
Low Earth Orbit (less than 1000 km)
Satellite vs Fiber
Remote / hostile areasPoint-to-point vs BroadcastMobile communications“Right of way” for laying cables
16 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Modulation
Modulation: information signal + carrier signal → modulatedsignal
Speech signals have frequencies between 300 and 3000 HzSignals cannot propagate directly over all mediumsSpeech signals s(t) can be sent directly over a copper cable:but not over air or free-space“Carrier” signals are used to carry the “information” signals
Modulated signal transmitted over a medium
Demodulation: extracting information signal from themodulated signal
Types of modulation: Amplitude (AM), Phase (PM),Frequency (FM)
17 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
0 1 0 1 1 0 0 1 0 0 1 0 0
(a)
(b)
(c)
(d)
Phase changes
18 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Bandwidth of Modulated Signals
The same as the bandwidth of the “information” signal
The bandwidth is now around a “center” frequency — thefrequency of the “carrier”
Many signals can coexist simultaneously in the medium.
By using different carrier frequencies
19 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Modulation for FAX/Dial-up Internet
Send bits over telephone cable using Modem (Modulator -Demodulator)
Cable meant for carrying voice signals between 300-3000 Hz
Amplitude + phase modulation - series of sinusoidal pulses
Modulator: Bits are chunked, represented using sinusoidalpulses
Demodulator: Convert received sinusoidal pulse to bits
Clipped sinusoid is the basic signal
Variations achieved by modifying amplitude and phase
Represented on a constellation diagram
20 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
QPSK, QAM-16, QAM-64
Quadrature Phase Shift keying (2 bits per sample), QuadratureAmplitude Modulation
270
(a)
90
0 180
270
(b)
90
0
270
(c)
90
0 180
21 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Telephone/FAX Modem
Each pulse represents multiple bits
If we use 16 different types of pulses (eg., QAM 16) we cansend 4 bits per pulse (16 = 24)
Bit rate and Baud rate
Baud rate - number of sinusoidal pulses per secondFixed at 2400 for telephone linesBit rate = Baud rate x number of bits per pulseHow do we get 56 K with baud rate of 2400?
22 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Trellis Coded Modulation
Add more bits per sampleAdd extra bits to each sample for error correctionV.32 (4+1, 32) - 9600 bps, V.32 bis (6 + 1, 128) 14,400 bpsV.34 - 28,800 bps, V.34 bis - 36,600 bps
270
(b)
90
270
(c)
90
0 180 0 180
23 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Modern Modems
Full duplex - transmissions possible in both directions at thesame time
Half-duplex - Both directions, but not at the same time
Simplex - Only one direction
V.90, V.92 - full duplex
Dedicated uplink and downlink channel
56 kbps downlink, 33.6 kbps uplink (V.90)
48kbps uplink (V.92) + facility to detect incoming calls whileonline
24 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Actual Capacity of a Telephone Line
50
40
20
30
10
00 1000 2000 3000 4000
Meters5000 6000
Mpb
s
25 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
ADSL
We have been sitting on a gold-mine!
Telephones filter out higher frequencies to suppress noise
1.1 MhZ spectrum divided into 256 channels - 4312 Hz each(DMT - Discrete Multitone)
First channel used for POTS (plain old telephone service)
Pow
er
Voice Upstream Downstream
256 4-kHz Channels
0 25 1100 kHz
26 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
ADSL Equipment
DSLAM
Splitter
Codec
Splitter
Telephone
To ISP
ADSL modem
Ethernet
Computer
Telephone line
Telephone company end office Customer premises
Voice switch
NID
27 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Multiplexing and Demultiplexing
Multiplexing - many to one
Many signal mixed together to produce one signal. Themultiplexed signal is transmitted over a channel
Demultiplexing - one to many
Multiplexed signal is split into individual components
Types: FDM, TDM, CDM
28 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Frequency division multiplexing (FDM)
Telephone - 4000Hz per channel (450 + 3100 + 450)
300 3100
Channel 3
Channel 2
Channel 1
1
1
1
Atte
nuat
ion
fact
or
64
Frequency (kHz)
(c)
Channel 1 Channel 3Channel 2
68 72
60 64
Frequency (kHz)
(b)
Frequency (Hz)
(a)
68 72
60
29 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Wavelength Division Multiplexing (WDM)
Spectrum on the shared fiber
Pow
er
λ
Fiber 4 spectrum
Pow
er
λ
Fiber 3 spectrum
Pow
er
λ
Fiber 2 spectrum
Pow
er
λ
λ1
λ1+λ2+λ3+λ4
Fiber 1 spectrum
Pow
er
λ
Fiber 1λ2
Fiber 2λ3
Fiber 3Combiner Splitter
Long-haul shared fiber
λ4
λ2
λ4
λ1
λ3Fiber 4
Filter
30 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Time Division Multiplexing (TDM)
N signals, each having M samples per secInterleaved together in a channel which can carry NM samplesper secPOTS signal (speech or clipped sinusoids) sampled at 8000samples per sec (sent as 64000 bps - each sample isrepresented using 8 bits)T1 lines - 1.544 Mbps, 24 channels
Channel 1
Channel 2
Channel 3
Channel 4
Channel 24
193-bit frame (125 µsec)
7 Data bits per channel
per sample
Bit 1 is a framing code
Bit 8 is for signaling
0
1
31 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
TDM in Telephone Network
Telephone
End
office
Toll
office
Intermediate switching office(s)
Telephone
End
office
Toll
office
Local loop
Toll connecting
trunk
Very high bandwidth
intertoll trunks
Toll connecting
trunk
Local loop
32 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
T1, T2, T3, T4
6 5 4 3 2 1 05 1
4 0
6 2
7 3
6:17:14:1
4 T1 streams in
1 T2 stream out
6.312 Mbps
T2
1.544 Mbps
T1
44.736 Mbps
T3
274.176 Mbps
T4
7 T2 streams in 6 T3 streams in
33 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Code Division Multiple Access (CDMA)
TDM - different channels can overlap in frequencies, but notin time
FDM - no overlap in frequencies, overlap in time
CDMA - overlap in both time and frequency
Separable by orthogonality of codes
Two vectors are orthogonal if their inner-product is zero.
34 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
CDMA
Each bit is converted to a vector of chips
Different users assigned different orthogonal chip vectors
A user assigned vector x transmits x to send a one or −x tosend a zero
x .x = 1, x .(−x) = −1
x .y = 0 if y is orthogonal to x .
In practice difficult to obtain strict orthogonality
x .y can be made very small compared to 1
“Tolerable” interference with quasi-orthogonal sequences
CDMA is also more efficient (closer to Shannon’s limit)
35 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Data Rate of a Communication ChannelTransmission MediaModulationMultiplexing
Why CDMA?
If n chips per bit, then chip frequency n times higher thanbit-frequency
Energy to sent a bit spread over a larger frequency
Useful during war-time as transmission virtuallyindistinguishable for noise in any narrow band.
CDMA is also more efficient
Higher frequency and lower S/N takes us closer to Shannon’slimit
Capacity increases linearly with bandwidth (onlylogarithmically with S/N)
36 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
Characterizing Data Transmission
Bit-rate R and bit duration,
Packet duration τp
Propagation speed c , propagation delay τc
One-way delay
Round trip time (RTT)
37 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
Packet Duration
Bit duration is the inverse of the bit-rate R
If bit rate is 1 Mbps, the bit duration is 1 µs
1 Kbps ↔ 1 ms, 1 Gbps ↔ 1 ns.
Packet duration is bit-duration times packet size (number ofbits in the packet )
10 Mbps bit-rate: duration of a 100 byte packet isτp = 100× 8× 0.1 = 80µs.
1 Gbps bit-rate: duration of a 100 byte packet isτp = 100× 8 = 800ns = 0.8µs.
38 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
One-way Delay
propagation at the speed c (light speed in the medium)
c = 3× 108 m/s in free-space and air, c = 2.5× 108 m/s incopper.
Distance traveled in 1 µs is 250 m (25cm in 1 ns)
Over a 10 Mbps line of length 2500 m, how long does it taketo receive a 100 byte packet?
propagation delay is τc = 10µsassume transmission started at time t = 0leading edge of the packet sent at t = 0; trailing edge sent attime τp = 80µsleading edge arrives at t = 10µs; trailing edge arrives att = 90µs
39 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
One-way Delay
Pictorial Representation
t
τp
τc
distance
One-way Delay
One-way delay = Propagationdelay τc + packet duration τp
y axis is time
x axis represents distance
the slope represents speed ofpropagation
40 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
Repeaters
Used in long transmission lines
Converts electrical signals to bits, and back to electricalsignals, for retransmission
Repeaters placed strategically to ensure that signal strengthreceived at repeaters is strong enough to eliminate errors
The conversion process eliminates the effects of noise betweenrepeaters or between repeaters and end-points.
Repeaters introduce additional propagation delay
For a line of length 2500 m, with four repeaters (assume eachrepeater introduces a delay of 4µs) the propagation delay is10 + 4× 4 = 26µs.
41 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
Repeater Delay
Repeater Delay
Repeater Delay
Repeaters
packet duration does not affectrepeater delay
repeaters do not have to receivethe entire packet before startingthe conversion
Why not repeaters for analogcommunications?
42 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
Processing Delay
It takes a finite amount of time for the receiver to “process”the received packet (say, τr )
Data-link frames typically have a cyclic redundancy check(CRC) that will be verified (if inconsistent drop the corruptedpacket)
Routers will need time to look-up routing tables to determinethe best next hop.
There may also be queuing delay at routers
Routers may have several incoming and outgoing interfaces
A queue in an incoming interface may be stuck if the outgoinginterface for the packet at the head of the queue is busy.
43 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
Round Trip Time
Typically, every packet is acknowledged.
Round trip time (RTT) = Packet duration τp + propagationdelay τc + processing delay τr + duration of acknowledgementτ ′p + ack propagation delay τc + ack processing delay τ ′r .
A decent approximation is RTT = 2× (τp + τc + τr )
What is the RTT over a 10 Mbps line of length 2500 m, if thepacket size (both sent and ACK) is 100 bytes, and theprocessing delay is 5 µs?
For the same length, packet size, and processing delay, what isthe RTT if the bit-rate is 1 Gbps?
44 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
Multi-hop Propagation
One way propagation delay for a channel with n hops isn(τc + τp + τr )
τp
τr
τc
45 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
RepeatersRound Trip Time
A Simpler Representation of Delays
Representation
t
τc
τp
τr
τ
τ ′c
τ ′p
τ ′r
A
B
C
Simpler Representation
Forward path AB, reverse pathBC
τ = τc + τp + τr total forwardpath delay (τ ′ = τ ′c + τ ′p + τ ′rtotal reverse path delay)
In the simpler representationonly the lines AB and BC willbe depicted
Also often rotated by 90 degrees(time in X -axis)
46 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
Switching
Circuit Switching
Cut-through Switching
Store and Forward Switching
Circuit switching was used in Telephone networks (not anylonger)
47 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
Circuit Switching
Physical path established over multiple links
Circuit established at the physical layer level
Delay for multi-hop propagation is the sum of propagationdelay over each link
Was used in Telephone networks (not any longer)
48 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
Cut-through Switching
Begin forwarding a packet to next hop even before the entirepacket has been received
Leading bytes in the packet will indicate destination
Useful when look-up for destination can be accomplished veryfast
Delay for multi-hop propagation similar to the situation whenrepeaters are used.
49 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
Store and Forward or Packet Switching
Entire packet received before the packet can be sent to nexthop
Packet duration influences the overall delay betweenend-points.
Two types: Virtual Circuits and Datagram Switching
50 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
Datagram Switching
Datagram Subnet
A E F Process P2
LAN
Router
1
Carrier's equipment
Process P1
B
H1 H2
D
C
Packet
3
4
2
A –
B B
initially
C C
D B
E C
F C
Dest.
A –
B B
laterA's table
C C
D B
E B
F B
A A
B A
C's table
C –
D D
E E
F E
A C
B D
E's table
C C
D D
E –
F F
Line
Datagram Switching
Routers maintain a routingtable indicating best next hopfor each destination
Routing tables are dynamic
Every packet routedindividually
Paths may change dynamically
Packets not guaranteed to bereceived in the same order.
51 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
Virtual Circuit Switching
VC Subnet
E FProcess P2
LAN
Router
1
Carrier's equipment
Process P1
Process P3
B
H1
H3
H2
D
C
3
42
H1 1
H3 1
C 1
C 2
A's table
A 1
A 2
E 1
E 2
C's table
C 1
C 2
F 1
F 2
E's table
A
In Out
Virtual Circuit
A path is established beforeeven the first packet can besent
Path accepted by all routers inthe path
Packets marked with a pathidentifier
Path identifier helps the routerdetermine how to forward thenext packet
Size of routing tables in arouter depends on number ofactive paths through therouter.
52 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
Datagram vs VC
53 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
Connectionless vs Connection-Oriented
Connectionless: Snail mail, telegram, etc.
Establishing connections makes the job of end points easier.
Circuit switching established a physical layer connection
Virtual circuits are established at the network layer level
In datagram-routing connection can be established at a higherlevel (transport layer).
54 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
Latency Example
Audio channel, 100 kbps (bit duration is 10µs)
10 hops, each 500 Km. τc = 20 ms (total for all 10 hops)
Assume low processing delay of 1µs at each hop (totalτr = 10µ s)
If packet size is 1000 bytes, packet duration τp = 80ms
Total delay 20 + 0.01 + 10 ∗ 80 ≈ 820ms
What if packet size is 100 bytes?
Total delay 20 + 0.01 + 10 ∗ 8 ≈ 100ms
What if channel rate is 100 Mbps? delay due to packetduration becomes negligible.
55 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Packet Switching
To realize low latency channels
Circuit switching — only propagation delay.
Cut-through switching
Store and forward (packet switching) vs cut-throughswitching — error checking at every hop
For circuit and cut-through switching packet duration isirrelevant.
For packet switching use smaller packet sizes in low-bit ratechannels
In high bit-rate links packet duration can be negligible(compared to propagation delay).
With ever increasing bit-rates the advantages of CircuitSwitching and Cut-through Switching become less relevant.
56 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Reliable Data Transfer
Need to transmit a sequence of packets over a link.
This is a requirement for data-link and transport layers
Link can be real (data link layer) or virtual (transport layer)
Packets can be corrupted (errors)
Over a virtual link packets can also arrive out of order, beduplicated, dropped, · · · .How does the sender know if the receiver got a specificpacket?
How does the receiver know that the sender knows? (ARQProtocols)
57 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Errors Are Unavoidable
Need to detect errors
correct errors / request retransmission
The key: redundancy — extra bits need to be transmitted fordetecting / correcting errors
Example: parity bits for error detection
58 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Hamming Distance
A metric for measuring “distances” between two sequences ofbits
A = 1000110
B = 1010100
How many bits need to be flipped to get B or A (orvice-versa)?
Two bits — the Hamming distance between A and B is 2.
59 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Error Detection with Parity Bit
A = 1000110
With even parity A = 10001101
With odd parity A = 10001100
For all subsequent discussions we will only use even parity
If any of the eight (7+1) bits of A is flipped duringtransmission parity check will fail.
What happens if two bits get flipped?
Parity check fails to detect error...
With one redundant bit we can only detect one-bit errors.
Actually any odd number of bit-errors
60 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Redundancy
Need to transmit m bit symbols (2m possible symbols)
r redundant bits (for error detection / correction)
n = m + r bits actually transmitted.
Efficiency is mm+r = m
n
In general, more the redundancy, more the errors that can bedetected / corrected
61 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
A Simple-Minded Approach
Just repeat every bit twice (efficiency 0.5) - any one bit errorcan be detected
Parity bit (just add one extra bit) - efficiency mm+1 is high for
large m.
How can we correct single bit errors automatically?
Repeat each bit two more times (efficiency 0.33)
Are there better ways?
62 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Error Detection vs Correction
Error correction needs more redundancy
Error detection is much more crucial than error correction —why?
Practical error detection techniques address the problem ofdetecting multiple-bit errors.
Error correction is usually used only for correction of single biterrors.
63 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Single Bit Errors are Statistically More Frequent!
Let us assume that the probability that any bit may beerroneously received is p = 10−9.
If N = 103 bits are transmitted, probability that there may bea bit error is roughly one in a million.
Probability that there may be two errors is roughly one in atrillion (million x million)
We need to detect even rare errors — but not a big deal if wecan not correct it (request re-Tx).
64 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Our Focus
How do we correct one-bit errors?
If the receiver is able to correct errors, the sender does notneed to retransmit
How do we detect multiple-bit errors?
If error is detected, the receiver can request the sender toretransmit
Or simply not acknowledge reception
65 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
One-bit Error Correction
Problem statement:
X is transmitted n-bit messageY is received n-bit messageH(X ,Y ) ≤ 1 (Hamming distance is at most 1)
For any X there is a set consisting of n + 1 possible Y s
Y = X , orother n cases where only one bit is flipped (first or second or· · · or nth)
Example, X = 1011101 (n = 7), Y has eight possible values
Y ∈[
1011101 1011100 1011111 10110011010101 1001101 1111101 0011101
]
66 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
One-bit Error Correction
For each X there is a Y -set (n + 1 possible Y s)
Each set includes X , and n values one Hamming distanceaway away from X
What is the maximum number of non-overlapping sets?2n/(n + 1).
If X is a 7 bit number, then 2n/(n + 1) = 128/8 = 16
If X is a 10 bit numbers then 210/11 = 1024/11 = 93.09 (or93 non-overlapping sets)
67 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
One-bit Error Correction
If 2m ≤ 2n/(n + 1) we have a non overlapping set of Y s forevery m-bit number
For every m-bit number there is a set with i) an n-bit X andii) n numbers one Hamming distance away from X
The X s are 2m unique codes represented using n = m + r bits.
If any of the 2m X s are sent, we can readily identify which onewas sent even if a bit was flipped in the channel.
To send an m-bit number over a noisy channel (in which notmore than one bit can get flipped) we send a n = m + r -bitcode
68 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Efficient Choice of n and m
If 2n/(n + 1) is a power of 2 then we have 2m = 2n/(n + 1).
Else we have to choose 2m < 2n/(n + 1) (which is notefficient as we waste some usable codes)
Efficient codes are represented as (m, n) (Hamming codes)
m = 1; n = 3; r = 2; — an efficient code as 21 = 23/4.
m = 2; n = 5 r = 3; — not efficient as 25/6 = 32/6 > 22 = 4
(m = 4, n = 7) (r = 3) is an efficient code(27/(7 + 1) = 128/8 = 16)
For efficient codes n = 2r − 1, m = n − r
r = 8, n = 256− 1 = 255, m = 255− 8 = 247: (247, 255)code
r = 10, n = 1024− 1 = 1023. m = 1023− 10 = 1013:(1013, 1023) code
69 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Hamming Codes
n = 2r − 1: efficient codes like(4, 7), (11, 15), . . . (1013, 1023), . . .
(4, 7) code: r = 3 parity bits, n = 7 transmitted bits, m = 4information bits.
Each code of the form b7 b6 b5 b4 b3 b2 b1
The bold bits are r = 3 parity bits. Other m = 4 bits are theactual information bits.
What is special about positions 1,2, and 4?
Powers of 2. (20, 21, 22).
70 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Hamming Code (4, 7)
b7 b6 b5 b4 b3 b2 b1
b1 is the parity bits for bits b7, b5, b3 (all odd positions7,5,3,1)
b2 is the parity for bits b3, b6, b7 (positions 2,3,6,7)
b4 is the parity for bits b5, b6, b7 (positions 4,5,6,7)
Assume we want to send m = 4 bits 1011
b7 = 1 b6 = 0 b5 = 1 b4 =? b3 = 1b2 =? b1 =?
b1 = 1, b2 = 0, b4 = 0 are the correct parities
The code for 1011 is 1010101
71 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Hamming Code Example
The receiver checks parity bits and writes down the results ofthe check as x4x2x1
x4 = 0 if parity b4; x4 = 1 if parity b4 is wrong.
If no bit is flipped by the channel then all parity bits will becorrect (result 000)
If b7 is flipped all three parities will be wrong (result 111)
If b3 is flipped result is 011
If b5 is flipped result is 101
See a pattern? The result gives the position of the erroneousbit.
Go ahead and flip it back.
72 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Hamming Code Example
Code X = 1010101
If Y = 1010101 (no error) result 000
If Y = 1010100 (pos 1 error) result 001
If Y = 1010111 (pos 2 error) result 010
If Y = 1010001 (pos 3 error) result 011
If Y = 1011101 (pos 4 error) result 100
If Y = 1000101 (pos 5 error) result 101
If Y = 1110101 (pos 6 error) result 110
If Y = 0010101 (pos 7 error) result 111
73 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
(11, 15) Hamming Code
Code b15 · · · b1b1, b2, b4, b8 are parity bitsExample 0 1 0 1 0 1 0 ? 0 0 1 ? 0 ? ? (11-bit information01010100010)b15 b14 b13 b12 b11 b10 b9 b8 b7 b6 b5 b4 b3 b2 b10 1 0 1 0 1 0 ? 0 0 1 ? 0 ? ?
0 1 0 1 0 1 0 ? 0 0 1 ? 0 ? 10 1 0 1 0 1 0 ? 0 0 1 ? 0 0 10 1 0 1 0 1 0 ? 0 0 1 1 0 0 10 1 0 1 0 1 0 1 0 0 1 1 0 0 1
Result written as x8x4x2x1.If bit 13 is flipped result is 1101
74 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Syndrome Coding
A syndrome is a “collection of symptoms.”
Each result of parity check is a symptom: each bit of theresult (for example 1011 if r = 4 is a symptom)
The syndrome should unambiguously indicate the error.
With r redundant bits, we have 2r unique syndromes
We can detect 2r − 1 different “diseases” (one syndromecorresponds to “no illness”).
n ≤ 2r − 1
75 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Burst Errors
Burst errors affect a consecutive sequence of bits
Power surges, explosions
Hamming codes can only detect one-bit errors
Can we handle burst errors?
Yes: by interleaving
76 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Interleaving
40 bits need to be sent
Use (7,4) Hamming code to encode 4 bits at a time: 40 bitsbecomes 70 bits at positions (1, 2, . . . , 70)
10 independent codes at positions (1, 2, 3, 4, 5, 6, 7),(8, 9, 10, 11, 12, 13, 14) · · · (64, 65, 66, 67, 68, 69, 70)
Reorder the sequence of 70 bits by interleaving
(1,8,15,. . . 64), (2,9,. . .,65), (3,10,. . .,66) · · · (7,14,. . . 70)
At the receiver: de-interleave and then decode
Any burst sequence up to 10 bits long will produce at mosterror in each of the ten codes
77 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Error Detection
Single error detection with parity bit
Burst error detection: Interleaving
78 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Multi-bit Error Detection
Double errors
arrange n = w × h bits as a matrix
Add parity bit for each row (we now have (w + 1)× h matrix)
Parity bit for each column — we end up with a(w + 1)× (h + 1) matrix
If 2 errors happen in the same row (column) they cannot be inthe same column (row)
79 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Cyclic Redundancy Checks (CRC)
A polynomial - y = P(x) = x r + ar−1xr−1 + · · ·+ a1x
1 + a0
If P(x) is in the field of real numbers, x , a0 . . . ar−1, y can beany real number
Any bit string can be seen coefficients of a polynomial in thefinite field {0, 1}P(x), x , a0 . . . ar−1 can only be 0 or 1
Example: 110101 is P(x) = x5 + x4 + x2 + x0.
Addition: 1 + 1 = 0 = 0 + 0, 1 + 0 = 0 + 1 = 1
Subtraction is the same as addition!
Multiplication: 1× 1 = 1, 0× x = 0.
P(0) = 1. P(1) = 1 + 1 + 1 + 1 = 0.
80 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Polynomial Arithmetic
P(x) = x5 + x4 + x2 + 1. Q(x) = x2 + x1
P(x) + Q(x) = x5 + x4 + x1 + 1
P(x)× Q(x) = (x5 + x4 + x2 + 1)(x2 + x1) =x7+x6+x4+x2+x6+x5+x3+x1 = x7+x5+x4+x3+x2+x1.
Polynomial division - what is P(x)/Q(x)
110 |110101 | 1001 (quotient)
110
---
000101
110
---
011 (remainder)
81 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
CRC
Choose a generator polynomial G (x) of degree r (r + 1 bitnumber)
Message to be sent M(x)
Append r zeros to M(x). The result is x rM(x).
Evaluate the remainder of x rM(x)/G (x) (remainder will be apolynomial of degree less than r) - say R(x)
Transmit T (x) = x rM(x)− R(x) = x rM(x) + R(x)
Receiver receives T (x)
In case of error receiver gets T ′(x) = T (x) + E (x)
Receiver checks if remainder of T ′(x)/G (x) is zero
If remainder is not zero receiver decides that there is an error
As T (x)/G (x) = 0, T ′(x)/G (x) = E (x)/G (x)
Errors where E (x)/G (x) is zero goes undetected
82 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Good choice for G (x)
Both highest and lowest order bits should be 1 (1xx · · · xx1)
If G (x) has degree more than 1 all single bit errors will bedetected - E (x) = x i .
Two isolated single bit errors E (x) = x i + x j = x j(x i−j + 1):any G (x) that does not have xk + 1 as a factor (for allk ≤ m) is sufficient
If x + 1 is not a factor, then all odd number of errors can bedetected.
Any burst error of length ≤ r can be detected
32 bit polynomial specified in IEEE 802x
83 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
ARQ (Automatic Repeat Request) Protocols
Packets need to be acknowledged
Time-out for retransmission
But acknowledgements can get lost too!
84 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Lost Acknowledgements
In (B) ACK was lost. So sender retransmits packet P1. Can bothsender and receiver agree that P1′ is a retransmission of P1 andnot P2?
Timeout Interval
X(B)
ACK ACK
P1 P1’
(A)
Timeout Interval
ACK
P1 P2
ACK
85 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Packet Numbers!
Packets need to be numbered
Obviously numbers will be “recycled”
How many unique sequence numbers do we need?
86 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Ambiguous Acknowledgements
The ACK was P1 was delayed. Sender retransmits P1. Soon after,ACK for P1 is received and sender sends P2 which gets lost.How does the sender know that the second acknowledgement is forP1 or P2?
Timeout Interval
X(C)
P1
ACK
P1’ P2
ACK
87 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Numbering
Acknowledgements need to be numbered too!
ABP protocol (alternating bit protocol)
One bit packets numbers - 0 or 1
One bit ACK numbers
Also called Stop and Wait Protocol (SWP)
Is ABP/SWP unambiguous?
88 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
Alternating Bit Protocol (ABP)
Timeout Interval
0
1 2
1
1 2
Packet NoSeq No
Ack NoPacket No
0 1
(D)
89 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
ABP is Unambiguous!
Timeout Interval
X(E)
1 1 2
0
0
0
Timeout Interval2
1 10
1 1 2
Timeout Interval
X(F)
10
10
0 0
2
2
1
Packet NoSeq No
Ack NoPacket No
Packet NoSeq No
Ack NoPacket No
90 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
ABP Sender Rules
If the last packet sent was numbered 0,
allowed to send the next packet with number 1 only after ACKfor 0 is received(else retransmit 0)
If the last packet sent was numbered 1,
allowed to send the next packet with number 0 only after ACKfor 1 is received(else retransmit 1)
91 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Error ControlError CorrectionError DetectionARQ ProtocolsAlternating Bit Protocol
ABP Receiver Rules
If last packet received was numbered 0
If 1 received ACK and keep (new packet)If 0 received ACK and drop (retransmission of previous packet)
If last packet received was numbered 1
If 0 received ACK and keep (new packet)If 1 received ACK and drop (retransmission of previous packet)
92 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Effective Data Rate
100 Mbps link A↔ B (R = 100x106), L = 2000m, packetsize F = 100 bits, τr = 1µs
P = τp = 100100000000 = 1µs, τc = 2000
2.5×108 = 8µs
What is the effective data rate between A and B when ABP isused?
RTT = 2τp + 2τc + 2τr = 2 + 16 + 2 = 20.
In each 20 µs interval transmission occurs only for 1 µs
Effective data rate is 5 Mbps (P/RTT x R)
93 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Improving Throughput
During the first micro second sender sends the first packet
Sender does nothing for 19 µs. ACK for first packet receivedafter 20µs
What if sender is allowed to send 20 packets before receivingthe ACK for the first packet?
Only after the ACK for the first packet is received the sendercan send packet 21
Only after the ACK for the second packet is received can thesender send packet 22, and so on
Window size of 20 packets
More generally, Window size ≥ RTT/packet duration
94 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Pipelining Example, W ≥ RTT/τp = 13
0
0
RTT
1 2 3 4 5 6 7 8 9 10 11 12
13 packets (0 to 12) sent in one RTT
ACK for 0 processed; ready to send 13
13
1
ACK for 1 rcd; ready to send 14
14
2
95 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Pipelining Example, W ≥ RTT/τp = 13
0
0
RTT
1
2 3 4 5 6 7 8 9 10 11 12
13 packets (0 to 12) sent in one RTT
ACK for 0 processed; ready to send 13
13
1
ACK for 1 rcd; ready to send 14
14
2
95 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Pipelining Example, W ≥ RTT/τp = 13
0
0
RTT
1 2
3 4 5 6 7 8 9 10 11 12
13 packets (0 to 12) sent in one RTT
ACK for 0 processed; ready to send 13
13
1
ACK for 1 rcd; ready to send 14
14
2
95 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Pipelining Example, W ≥ RTT/τp = 13
0
0
RTT
1 2 3 4 5 6 7 8 9 10 11
12
13 packets (0 to 12) sent in one RTT
ACK for 0 processed; ready to send 13
13
1
ACK for 1 rcd; ready to send 14
14
2
95 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Pipelining Example, W ≥ RTT/τp = 13
0
0
RTT
1 2 3 4 5 6 7 8 9 10 11 12
13 packets (0 to 12) sent in one RTT
ACK for 0 processed; ready to send 13
13
1
ACK for 1 rcd; ready to send 14
14
2
95 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Pipelining Example, W ≥ RTT/τp = 13
0
0
RTT
1 2 3 4 5 6 7 8 9 10 11 12
13 packets (0 to 12) sent in one RTT
ACK for 0 processed; ready to send 13
13
1
ACK for 1 rcd; ready to send 14
14
2
95 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Pipelining Example, W ≥ RTT/τp = 13
0
0
RTT
1 2 3 4 5 6 7 8 9 10 11 12
13 packets (0 to 12) sent in one RTT
ACK for 0 processed; ready to send 13
13
1
ACK for 1 rcd; ready to send 14
14
2
95 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Pipelining
The secret to higher throughput
ABP needs only half-duplex channels, for pipelining weimplicitly assume full duplex channels
ACKs and packets cross each other
Nodes may need to buffer packets when things do not go well
What is the buffer size needed?
How do we number packets and acknowledgements ?
96 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Selective Repeat Protocol
Similar to ABP, with window size W packets
Or ABP is SRP with window size 1 packet
Buffer size (W . Why?)
Numbering packets? (2W unique numbers. Why?)
97 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
SRP Protocol
Sender Window (size 5)
Sent and ACKed
ACK pending
Not yet sent
3 4 5 6 7 8 9 0 1 2 3 4
SRP Sender Rules
Legal to send any packet within the window
Head of the queue blocked by an outstandingACK.
Sender window can not advance until ACK isreceived for the blocking packet.
Normally next unsent packet (blue) is sent.
On time-out for the blocking red packetresend the packet.
Sender may have to buffer up to W packets.
2W unique packet numbers — 0 to 2W − 1.
98 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
SRP Window
Rx. Window
received
pending
p.w f.w
3 4 5 6 7 8 9 0 1 2 3 4
Receiver Rules
Past Window and Future Window; each of size W .
Packets left of the Past Window: Receipt of ACKconfirmed by sender
Packets in the Past Window: ACKs not confirmed bysender
Future Window blocked by earliest pending packet.
Next packet received can be from either window
If packet from past window ACK and drop packet
If packet from future window ACK and store packet
Past Window is the lower bound on sender windowposition. Reception of 8 → ACK for 3 confirmed.
Future window is the upper bound on sender windowposition
99 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
SRP Window
Rx. Window
received
pending
3 4 5 6 7 8 9 0 1 2 3 4
Receiver Rules
Up to W packets may need to be buffered
2W possibilities for next packet. Using 2W distinctnumbers eliminates ambiguities.
If next received packet is numbered 4, 5, 6, 7 or 8 ACKand discard.
If next received packet is numbered 9, 0, 1, 2 or 3 ACKand store.
100 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Negative Acknowledgments (NACK)
Assume ACK for packet number 2 not received
Normally sender would wait for a timeout period
What if an ACK for 3 (while 2 is missing) is interpreted as aNACK for 2?
ACK for 3 is generally received well before time-out for 2.
101 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Go Back N - GBN Protocol
Window size W
Sender logic is the same
Receiver does not buffer packets (no window)
Out of sequence packets are simply discarded
Periodically sends acknowledgement for the last receivedpacket number
Example, if Rx gets packets 1,2,3,4,5,7,8,9 the ACK for 5 issent. 7,8,9 not ACKed.
Sender retransmits 6,7,8,9...
102 / 103
Data Communication ChannelsRate and Delay
SwitchingReliable Data Transfer
Reliable and Efficient Data Transfer
Sliding Window Protocols
Windowing Protocols in DL vs TL
Window size need not always be expressed in packets
If expressed in packets we assume equal duration packets(window size is “number of packet durations in one RTT”)
It can be in bits too (“number of bits that can be sent in oneRTT”)
Or bytes (“number of bytes that can be sent in one RTT”)
In transport layer window size is expressed in bytes
In data link layer, the link parameters like τp, τc , τr , RTT etc.,are known at design time. (Easy to compute W ≥ RTT/τp).
In TL how well do we know the “virtual link” parameters?How do we choose window size?
103 / 103