Upload
corey-jennings
View
214
Download
0
Tags:
Embed Size (px)
Citation preview
Winter 2008 CS244a Handout 12 1
CS244a: An Introduction to Computer Networks Handout 12: Physical Layer
Sending 1’s and 0’s, Capacity and Clocking
Nick McKeownProfessor of Electrical Engineering and Computer Science, Stanford University
[email protected]://www.stanford.edu/~nickm
Winter 2008 CS244a Handout 12 2
Outline
Bits at the physical layer Representing 1’s and 0’s What dictates the data-rate on a link?
Clock recovery How does a receiver know what data rate the sender used? Elasticity buffers
Winter 2008 CS244a Handout 12 3
Signaling bits on a linkMost electrical and optical networks signal bits
using two distinct voltage/power levels.
0
1 1
00
5
time
Volts
Coaxial cableTwisted pair
0
1 1
00mW
10mW
time
Power
Optical Fiber
Rise and fall times
Winter 2008 CS244a Handout 12 4
Signaling bits on a linkAll links have a maximum bandwidth, and hence a minimum rise
and fall time. Intuitively, this limits how close together consecutive bits can be placed, and so limits the maximum
capacity or data rate of the link.
Frequency
Mag
nit
ud
e
Bandwidth
Frequency
Mag
nit
ud
e
Bandwidth
Winter 2008 CS244a Handout 12 5
Signaling bits on a link Multi-level Signaling
1
Levels
2
3
4
00 11 10 01 001
Levels
2345678
000 010 101 001 110
2-bits per symbol 3-bits per symbol
Ultimately, what limits the number of bits I can send per symbol?
Winter 2008 CS244a Handout 12 6
Signaling bits on a link Frequency division multiplexing (FDM)
Frequency
Mag
nit
ud
e
Bandwidth
f1f0
What limits how close together the frequencies can be?
For a given bandwidth, how many frequencies can we use?
Winter 2008 CS244a Handout 12 7
Coding schemes
High speed links use a selection of complicated techniques to “squeeze” the maximum data-rate out of the link that they can. Techniques: FDM, phase modulation, multi-level signaling,
CDMA, pulse-position modulation (PPM), … Links: Modems, DSL (Digital Subscriber Line), Fast
Ethernet, Gigabit Ethernet, Wireless Ethernet, …
Capacity: the maximum data rate of a link Why does the output of a modem sound like “white noise”? What ultimately limits the capacity?
Winter 2008 CS244a Handout 12 8
Maximum Capacity/Data Rate
Shannon Capacity:
)/1(log2 NSBC Bandwidth of link Signal-to-Noise ratio
For example: Bandwidth of telephone link from telephone to a typical home is approx 3300Hz – 300Hz = 3kHz Signal-to-noise ratio is approx 30dB = 10log10(S/N) Therefore, C = 3000*log2(1001) ~= 30kb/s
Optical fiber has a higher capacity because the bandwidth, B, of a fiber is much greater than for wire; and it is less susceptible to noise,
N.
Winter 2008 CS244a Handout 12 9
Outline
Bits at the physical layer Representing 1’s and 0’s What dictates the data-rate on a link?
Clock recovery How does a receiver know what data rate the sender used? Elasticity buffers
Winter 2008 CS244a Handout 12 10
Encoding for clock recoveryProblem:
Different hosts use locally-generated clocks of nominally the same frequency, but slightly different. E.g. 10MHz +/- 100ppm (“parts per million”)1.
The receiver needs to “recover” the senders clock from the data stream, for example:
10MHz clock +/- 100ppm
Flip-Flop
Flip-Flop
Sender
Sender’s Clock
Flip-Flop
Clock RecoveryUnit
10MHz clock +/- 100ppm
Receiver
NetworkLink
1) One part per million equals 10-4%.
Elasticity buffer
Winter 2008 CS244a Handout 12 11
If we don’t know the sender’s clock
Data
TX Clock
6
6
(1 10 ).
0.5
10
I f the RX clock is ppm slower than the TX clock, then:
Af ter bit times, the RX clock will miss a bit.
Rx Txp T T p
p
RX Clock
Missed!
TRx
TTx
Winter 2008 CS244a Handout 12 12
Asynchronous communication
Startbit
Stopbit
0 1 1 0 1 0 0
P bits per packet
IdealRX Clock
ActualRX Clock
Asynchronous communications sometimes used for links with short packets.
Winter 2008 CS244a Handout 12 13
Encoding for clock recovery
Data
Clock
Sampling points
It is more common for the receiver to recover the clock from the received data stream.
If the clock is not sent separately, the data stream must have sufficient transitions so that the receiver
can determine the clock.
Winter 2008 CS244a Handout 12 14
Encoding for clock recoveryExample #1: Ethernet
Data
Clock
Manchester
Advantages of Manchester encoding: Guarantees one transition per bit period Ensures d.c. balance (i.e. equal numbers of hi and lo)
Disadvantages Doubles bandwidth needed
0 Volts
The threshold between hi and lo can be set at the
long-term average value.
0 1 1 0 1 0 1 1
Winter 2008 CS244a Handout 12 15
Frequency Spectrum for 10Mb/s Ethernet
10MHz5MHz freq freq
Magnit
ude
Magnit
ude
Without Manchester coding With Manchester coding
Used by the clock recovery unit to determine the transmitter’s
clock
5MHz
Winter 2008 CS244a Handout 12 16
Encoding for clock recoveryExample #2: FDDI
Advantages of 4b/5b encoding: More bandwidth efficient (only 25% overhead). Allows extra codes to be used for control information.
Disadvantages Fewer transitions can make clock recovery harder.
4-bit data 5-bit code
0000 11110
0001 01001
0010 10100
… …
Winter 2008 CS244a Handout 12 17
Outline
Bits at the physical layer Representing 1’s and 0’s What dictates the data-rate on a link?
Clock recovery How does a receiver know what data rate the sender used? Elasticity buffers
Winter 2008 CS244a Handout 12 18
The need for an elasticity bufferProblem:
The sender’s clock may be slower or faster than the receiver’s
clock. e.g. 10MHz +/- 100ppm (“parts per million”).
How big should the FIFO be?
10MHz clock +/- 100ppm
Flip-Flop
Flip-Flop
Sender
Sender’s Clock
Flip-Flop
Clock RecoveryUnit
10MHz clock +/- 100ppm
Receiver
NetworkLink
B
Elasticity buffer
max min .Clock tolerance R R
R
R R
Winter 2008 CS244a Handout 12 19
Sizing an elasticity buffer
time
Cum
ula
tive b
yte
s
Receiver clock faster: Elasticity
buffer underflows
Receiver clock slower: Elasticity buffer overflows
BTr
ansm
itted
byt
es
Received bytes
Winter 2008 CS244a Handout 12 20
Sizing an elasticity bufferB
1. At start of new packet, allow buffer to fillto B/2.
2. Size buffer so that it does not overflow or underflow before packet completes.
3. Ensure that the inter-packet gap is long enoughto allow buffer to drain before next packet arrives.
Winter 2008 CS244a Handout 12 21
Preventing overflow
time
Cum
ula
tive b
yte
s
Interpacketgap
MaxPacket
Size, Pmax
B/2Rmax
Rmin
Rmax
Transmitted bytes
Received bytes
Pmax/Rmax
maxmax min
max max
max min min minmax
max max max
max min max minmax max
max
2
. 1.2
/ 2
We require:
But
require
P BP R B
R R
R R B R RP B
R R R
R R R RP P B
R R
To prevent overflow:
Winter 2008 CS244a Handout 12 22
Preventing underflow
time
Cum
ula
tive b
yte
s
Interpacketgap
MaxPacket
Size, Pmax
B/2Rmin
Rmax
Rmin
Transmitted bytes
Received bytes
max max
max min min
max min max minmax max
max
2
/ 2
We require: P PB
R R R
R R R RP P B
R R
To prevent underflow:
(Pmax/Rmax) + (B/2Rmin)
Winter 2008 CS244a Handout 12 23
Sizing an elasticity bufferExample: FDDI
Maximum packet size 4500bytesClock tolerance +/- 50ppm
6max min
6
100 10
2(4500 8 100 10 ) 7
R R
R
B bits
Therefore, 1. Buffer larger than 7 bits2. Wait for at least 3.5 bits before draining buffer3. Inter-packet gap at least 3.5bits