23
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 McKeown Professor of Electrical Engineering and Computer Science, Stanford University [email protected] http://www.stanford.edu/~nickm

CS244a: An Introduction to Computer Networks

  • Upload
    brit

  • View
    27

  • Download
    0

Embed Size (px)

DESCRIPTION

CS244a: An Introduction to Computer Networks. Handout 12: Physical Layer Sending 1’s and 0’s, Capacity and Clocking. Nick McKeown Professor of Electrical Engineering and Computer Science, Stanford University [email protected] http://www.stanford.edu/~nickm. Outline. - PowerPoint PPT Presentation

Citation preview

Page 1: CS244a: An Introduction to Computer Networks

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 [email protected]://www.stanford.edu/~nickm

Page 2: CS244a: An Introduction to Computer Networks

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

Page 3: CS244a: An Introduction to Computer Networks

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

Page 4: CS244a: An Introduction to Computer Networks

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

nitu

de

Bandwidth

Frequency

Mag

nitu

de

Bandwidth

Page 5: CS244a: An Introduction to Computer Networks

Winter 2008 CS244a Handout 12 5

Signaling bits on a link Multi-level Signaling

1

Levels23

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?

Page 6: CS244a: An Introduction to Computer Networks

Winter 2008 CS244a Handout 12 6

Signaling bits on a link Frequency division multiplexing (FDM)

Frequency

Mag

nitu

de

Bandwidth

f1f0

What limits how close together the frequencies can be?

For a given bandwidth, how many frequencies can we use?

Page 7: CS244a: An Introduction to Computer Networks

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?

Page 8: CS244a: An Introduction to Computer Networks

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.

Page 9: CS244a: An Introduction to Computer Networks

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

Page 10: CS244a: An Introduction to Computer Networks

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

ReceiverNetwork

Link

1) One part per million equals 10-4%.

Elasticity buffer

Page 11: CS244a: An Introduction to Computer Networks

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

Page 12: CS244a: An Introduction to Computer Networks

Winter 2008 CS244a Handout 12 12

Asynchronous communication

Startbit

Stopbit

0 1 1 0 1 0 0

P bits per packet

IdealRX ClockActualRX ClockAsynchronous communications sometimes used for links with short packets.

Page 13: CS244a: An Introduction to Computer Networks

Winter 2008 CS244a Handout 12 13

Encoding for clock recovery

DataClock

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.

Page 14: CS244a: An Introduction to Computer Networks

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

Page 15: CS244a: An Introduction to Computer Networks

Winter 2008 CS244a Handout 12 15

Frequency Spectrum for 10Mb/s Ethernet

10MHz5MHz freq freq

Mag

nitu

de

Mag

nitu

de

Without Manchester coding With Manchester coding

Used by the clock recovery unit to determine the transmitter’s

clock

5MHz

Page 16: CS244a: An Introduction to Computer Networks

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 code0000 111100001 010010010 10100

… …

Page 17: CS244a: An Introduction to Computer Networks

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

Page 18: CS244a: An Introduction to Computer Networks

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

ReceiverNetwork

Link

B

Elasticity buffer

max min .Clock tolerance R RR

R R

Page 19: CS244a: An Introduction to Computer Networks

Winter 2008 CS244a Handout 12 19

Sizing an elasticity buffer

time

Cum

ulat

ive

byte

s Receiver clock faster: Elasticity

buffer underflows

Receiver clock slower: Elasticity buffer overflows

BTransm

itted byte

s

Received bytes

Page 20: CS244a: An Introduction to Computer Networks

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.

Page 21: CS244a: An Introduction to Computer Networks

Winter 2008 CS244a Handout 12 21

Preventing overflow

time

Cum

ulat

ive

byte

s

Interpacketgap

MaxPacket

Size, Pmax

B/2Rmax

Rmin

Rmax

Transmitted bytesReceived 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 BR R

R R B R RP BR R R

R R R RP P BR R

To prevent overflow:

Page 22: CS244a: An Introduction to Computer Networks

Winter 2008 CS244a Handout 12 22

Preventing underflow

time

Cum

ulat

ive

byte

s

Interpacketgap

MaxPacket

Size, Pmax

B/2Rmin

Rmax

Rmin

Transmitted bytesReceived bytes

max max

max min min

max min max minmax max

max

2

/ 2

We require: P PBR R R

R R R RP P BR R

To prevent underflow:

(Pmax/Rmax) + (B/2Rmin)

Page 23: CS244a: An Introduction to Computer Networks

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 RR

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