Computer Networks - Washington

48
Computer Networks Shyam Gollakota

Transcript of Computer Networks - Washington

ComputerNetworksShyamGollakota

2

ScopeofthePhysicalLayer•  Concernshowsignalsareusedtotransfermessagebitsoveralink– Wiresetc.carryanalogsignals– Wewanttosenddigitalbits

…1011010110…

Signal

SimpleLinkModel•  We’llendwithanabstracFonofaphysicalchannel

–  Rate(orbandwidth,capacity,speed)inbits/second–  Delayinseconds,relatedtolength

•  OtherimportantproperFes:– Whetherthechannelisbroadcast,anditserrorrate

CSE461UniversityofWashington 3

DelayD,RateR

Message

MessageLatency•  Latencyisthedelaytosendamessageoveralink

–  Transmissiondelay:FmetoputM-bitmessage“onthewire”

–  PropagaFondelay:Fmeforbitstopropagateacrossthewire

–  Combiningthetwotermswehave:

CSE461UniversityofWashington 4

MessageLatency(2)•  Latencyisthedelaytosendamessageoveralink

–  Transmissiondelay:FmetoputM-bitmessage“onthewire”

T-delay=M(bits)/Rate(bits/sec)=M/Rseconds

–  PropagaFondelay:Fmeforbitstopropagateacrossthewire

P-delay=Length/speedofsignals=Length/⅔c=Dseconds

–  Combiningthetwotermswehave:L=M/R+D

CSE461UniversityofWashington 5

CSE461UniversityofWashington 6

MetricUnits•  Themainprefixesweuse:

•  Usepowersof10forrates,2forstorage–  1Mbps=1,000,000bps,1KB=210bytes

•  “B”isforbytes,“b”isforbits

Prefix Exp. prefix exp. K(ilo) 103 m(illi) 10-3

M(ega) 106 µ(micro) 10-6

G(iga) 109 n(ano) 10-9

CSE461UniversityofWashington 7

LatencyExamples(2)•  “Dialup”withatelephonemodem:

D=5ms,R=56kbps,M=1250bytes

L=5ms+(1250x8)/(56x103)sec=184ms!

•  Broadbandcross-countrylink:D=50ms,R=10Mbps,M=1250bytes

L=50ms+(1250x8)/(10x106)sec=51ms

•  Alonglinkoraslowratemeanshighlatency–  Oden,onedelaycomponentdominates

CSE461UniversityofWashington 8

Bandwidth-DelayProduct•  Messagestakespaceonthewire!

•  Theamountofdatainflightisthebandwidth-delay(BD)product

BD=RxD– Measureinbits,orinmessages–  SmallforLANs,bigfor“longfat”pipes

CSE461UniversityofWashington 9

Bandwidth-DelayExample(2)•  Fiberathome,cross-country

R=40Mbps,D=50msBD=40x106x50x10-3bits

=2000Kbit=250KB

•  That’squitealotofdata“inthenetwork”!

110101000010111010101001011

10

Topic•  We’vetalkedaboutsignalsrepresenFngbits.How,exactly?–  ThisisthetopicofmodulaFon

…1011010110…

Signal

ASimpleModulaFon•  Letahighvoltage(+V)representa1,andlowvoltage(-V)representa0– ThisiscalledNRZ(Non-ReturntoZero)

11

Bits

NRZ

0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

+V

-V

ASimpleModulaFon(2)•  Letahighvoltage(+V)representa1,andlowvoltage(-V)representa0– ThisiscalledNRZ(Non-ReturntoZero)

12

Bits

NRZ

0 0 1 0 1 1 1 1 0 1 0 0 0 0 1 0

+V

-V

ModulaFon

13

NRZsignalofbits

Amplitudeshidkeying

Frequencyshidkeying

Phaseshidkeying

SignalsoveraWire(2)•  Example:

14

2:AmenuaFon:

3:Bandwidth:

4:Noise:

Sentsignal

CSE461UniversityofWashington 15

SignalsoverWireless•  Signalstransmimedonacarrierfrequency,likefiber

•  Travelatspeedoflight,spreadoutandamenuatefasterthan1/dist2

•  MulFplesignalsonthesamefrequencyinterfereatareceiver

16

SignalsoverWireless(5)•  Variousothereffectstoo!

– WirelesspropagaFoniscomplex,dependsonenvironment

•  Somekeyeffectsarehighlyfrequencydependent,–  E.g.,mulFpathatmicrowavefrequencies

WirelessMulFpath•  SignalsbounceoffobjectsandtakemulFplepaths

–  Somefrequenciesamenuatedatreceiver,varieswithlocaFon– Messesupsignal;handledwithsophisFcatedmethods(§2.5.3)

17

18

Wireless•  Senderradiatessignaloveraregion

–  InmanydirecFons,unlikeawire,topotenFallymanyreceivers

–  Nearbysignals(samefreq.)interfereatareceiver;needtocoordinateuse

19

WiFi

WiFi

Wireless(2)•  Microwave,e.g.,3G,andunlicensed(ISM)frequencies,e.g.,WiFi,arewidelyusedforcomputernetworking

20

802.11b/g/n

802.11a/g/n

21

ShannonCapacity(2)•  Shannonlimitisforcapacity(C),themaximuminformaFoncarryingrateofthechannel:

C=Blog2(1+S/(BN))bits/sec

Pusngitalltogether–DSL•  DSL(DigitalSubscriberLine,see§2.6.3)iswidelyusedforbroadband;manyvariantsoffer10sofMbps–  Reusestwistedpairtelephonelinetothehome;ithasupto~2MHzofbandwidthbutusesonlythelowest~4kHz

CSE461UniversityofWashington 22

DSL(2)•  DSLusespassbandmodulaFon(calledOFDM§2.5.1)

–  Separatebandsforupstreamanddownstream(larger)– ModulaFonvariesbothamplitudeandphase(calledQAM)–  HighSNR,upto15bits/symbol,lowSNRonly1bit/symbol

CSE461UniversityofWashington 23

Upstream Downstream

26–138kHz

0-4kHz 143kHzto1.1MHz

Telephone

Freq.

Voice Upto1Mbps Upto12Mbps

ADSL2:

CSE461UniversityofWashington 24

ScopeoftheLinkLayer•  Concernshowtotransfermessagesoveroneormoreconnectedlinks– Messagesareframes,oflimitedsize–  Buildsonthephysicallayer

Frame

TypicalImplementaFonofLayers

CSE461UniversityofWashington 25

CSE461UniversityofWashington 26

Topic•  ThePhysicallayergivesusastreamofbits.Howdoweinterpretitasasequenceofframes?

…10110…

Um?

CSE461UniversityofWashington 27

FramingMethods•  We’lllookat:

–  Bytecount(moFvaFon)»–  Bytestuffing»–  Bitstuffing»

•  InpracFce,thephysicallayerodenhelpstoidenFfyframeboundaries–  E.g.,Ethernet,802.11

CSE461UniversityofWashington 28

ByteCount•  Firsttry:

– Let’sstarteachframewithalengthfield!

–  It’ssimple,andhopefullygoodenough…

ByteCount(2)

•  Howwelldoyouthinkitworks?

CSE461UniversityofWashington 29

ByteCount(3)•  Difficulttore-synchronizeaderframingerror

– Wantawaytoscanforastartofframe

CSE461UniversityofWashington 30

CSE461UniversityofWashington 31

ByteStuffing•  Bemeridea:

–  Haveaspecialflagbytevaluethatmeansstart/endofframe

–  Replace(“stuff”)theflaginsidetheframewithanescapecode

–  ComplicaFon:havetoescapetheescapecodetoo!

ByteStuffing(2)•  Rules:

–  ReplaceeachFLAGindatawithESCFLAG–  ReplaceeachESCindatawithESCESC

CSE461UniversityofWashington 32

ByteStuffing(3)•  NowanyunescapedFLAGisthestart/endofaframe

CSE461UniversityofWashington 33

CSE461UniversityofWashington 34

BitStuffing•  Canstuffatthebitleveltoo

– CallaflagsixconsecuFve1s– Ontransmit,aderfive1sinthedata,inserta0

– Onreceive,a0aderfive1sisdeleted

BitStuffing(2)•  Example:

CSE461UniversityofWashington 35

Transmimedbitswithstuffing

Databits

BitStuffing(3)•  Sohowdoesitcomparewithbytestuffing?

CSE461UniversityofWashington 36

Transmimedbitswithstuffing

Databits

CSE461UniversityofWashington 37

Topic•  Somebitswillbereceivedinerrordue

tonoise.Whatcanwedo?–  Detecterrorswithcodes»–  Correcterrorswithcodes»–  Retransmitlostframes

•  Reliabilityisaconcernthatcutsacrossthelayers–we’llseeitagain

Later

Problem–Noisemayflipreceivedbits

CSE461UniversityofWashington 38

Signal0 0 0 0

11 10

0 0 0 011 1

0

0 0 0 011 1

0

SlightlyNoisy

Verynoisy

CSE461UniversityofWashington 39

Approach–AddRedundancy•  ErrordetecFoncodes

–  Addcheckbitstothemessagebitstoletsomeerrorsbedetected

•  ErrorcorrecFoncodes–  Addmorecheckbitstoletsomeerrorsbecorrected

•  KeyissueisnowtostructurethecodetodetectmanyerrorswithfewcheckbitsandmodestcomputaFon

CSE461UniversityofWashington 40

MoFvaFngExample•  Asimplecodetohandleerrors:

–  Sendtwocopies!Errorifdifferent.

•  Howgoodisthiscode?–  Howmanyerrorscanitdetect/correct?–  Howmanyerrorswillmakeitfail?

CSE461UniversityofWashington 41

MoFvaFngExample(2)•  Wewanttohandlemoreerrorswithlessoverhead– Willlookatbemercodes;theyareappliedmathemaFcs

–  But,theycan’thandleallerrors–  Andtheyfocusonaccidentalerrors(willlookatsecurehasheslater)

CSE461UniversityofWashington 42

UsingErrorCodes•  CodewordconsistsofDdataplusR

checkbits(=systemaFcblockcode)

•  Sender:–  ComputeRcheckbitsbasedontheDdatabits;sendthecodewordofD+Rbits

D R=fn(D)Databits Checkbits

CSE461UniversityofWashington 43

UsingErrorCodes(2)•  Receiver:

–  ReceiveD+Rbitswithunknownerrors–  RecomputeRcheckbitsbasedontheDdatabits;errorifRdoesn’tmatchR’

D R’Databits Checkbits

R=fn(D)=?

CSE461UniversityofWashington 44

IntuiFonforErrorCodes•  ForDdatabits,Rcheckbits:

•  Randomlychosencodewordisunlikelytobecorrect;overheadislow

AllcodewordsCorrect

codewords

CSE461UniversityofWashington 45

R.W.Hamming(1915-1998)•  Muchearlyworkoncodes:

–  “ErrorDetecFngandErrorCorrecFngCodes”,BSTJ,1950

•  Seealso:–  “YouandYourResearch”,1986

Source:IEEEGHN,©2009IEEE

CSE461UniversityofWashington 46

HammingDistance•  DistanceisthenumberofbitflipsneededtochangeD1toD2

•  Hammingdistanceofacodeistheminimumdistancebetweenanypairofcodewords

CSE461UniversityofWashington 47

HammingDistance(2)•  ErrordetecFon:

–  Foracodeofdistanced+1,uptoderrorswillalwaysbedetected

CSE461UniversityofWashington 48

HammingDistance(3)•  ErrorcorrecFon:

–  Foracodeofdistance2d+1,uptoderrorscanalwaysbecorrectedbymappingtotheclosestcodeword