Point-to-PointLinks Outline Encoding Framing ErrorDetection - - PDF document

point to point links
SMART_READER_LITE
LIVE PREVIEW

Point-to-PointLinks Outline Encoding Framing ErrorDetection - - PDF document

Point-to-PointLinks Outline Encoding Framing ErrorDetection SlidingWindowAlgorithm Spring2002 CS461 1 Encoding Signalspropagateoveraphysicalmedium modulateelectromagneticwaves


slide-1
SLIDE 1

1

Spring2002 CS461 1

Outline

Encoding Framing ErrorDetection SlidingWindowAlgorithm

Point-to-PointLinks

Spring2002 CS461 2

Encoding

  • Signalspropagateoveraphysicalmedium

– modulateelectromagneticwaves – e.g.,varyvoltage

  • Encodebinarydataontosignals

– e.g.,0aslowsignaland1ashighsignal – knownasNon-Returntozero(NRZ)

Bits NRZ 1 1 1 1 1 1 1

Spring2002 CS461 3

Problem:Consecutive1sor0s

  • Lowsignal(0)maybeinterpretedasnosignal
  • Highsignal(1)leadstobaselinewander
  • Unabletorecoverclock
slide-2
SLIDE 2

2

Spring2002 CS461 4

AlternativeEncodings

  • Non-returntoZeroInverted(NRZI)

– makeatransitionfromcurrentsignaltoencodeaone; stayatcurrentsignaltoencodeazero – solvestheproblemofconsecutiveones

  • Manchester

– transmitXORoftheNRZencodeddataandtheclock – only50%efficient(bitrate=1/2baudrate)

Spring2002 CS461 5

Encodings (cont)

  • 4B/5B

– every4bitsofdataencodedina5-bitcode – 5-bitcodesselectedtohavenomorethanoneleading0 andnomorethantwotrailing0s – thus,nevergetmorethanthreeconsecutive0s – resulting5-bitcodesaretransmittedusingNRZI – achieves80%efficiency

Spring2002 CS461 6

Encodings(cont)

Bits NRZ Clock Manchester NRZI 1 1 1 1 1 1 1

slide-3
SLIDE 3

3

Spring2002 CS461 7

Framing

  • Breaksequenceofbitsintoaframe
  • Typicallyimplementedbynetworkadaptor

Frames Bits Adaptor Adaptor NodeB NodeA

Spring2002 CS461 8

Approaches

  • Sentinel-based

– delineateframewithspecialpattern:01111110 – e.g.,HDLC,SDLC,PPP – problem:specialpatternappearsinthepayload – solution:bitstuffing

  • sender:insert0afterfiveconsecutive1s
  • receiver:delete0thatfollowsfiveconsecutive1s

Header Body 8 16 16 8 CRC Beginning sequence Ending sequence Spring2002 CS461 9

Approaches(cont)

  • Couter-based

– includepayloadlengthinheader – e.g.,DDCMP – problem:countfieldcorrupted – solution:catchwhenCRCfails

SYN Header Body 8 8 42 14 16 8 SYN Class CRC Count

slide-4
SLIDE 4

4

Spring2002 CS461 10

Approaches(cont)

  • Clock-based

– eachframeis125uslong – e.g.,SONET:SynchronousOpticalNetwork – STS-n (STS-1=51.84Mbps)

Overhead Payload 90columns 9rows

STS-1 Hdr STS-1 Hdr STS-1 Hdr STS-3c Hdr Spring2002 CS461 11

CyclicRedundancyCheck

  • Addkbitsofredundantdatatoann-bitmessage

– wantk <<n – e.g.,k =32andn =12,000(1500bytes)

  • Representn-bitmessageasn-1degreepolynomial

– e.g.,MSG=10011010asM(x)=x7 +x4+x3 +x1

  • Letk bethedegreeofsomedivisorpolynomial

– e.g.,C(x)=x3 +x2 +1

Spring2002 CS461 12

CRC(cont)

  • TransmitpolynomialP(x)thatisevenlydivisible

byC(x)

– shiftleftk bits,i.e.,M(x)xk – subtractremainderofM(x)xk /C(x)fromM(x)xk

  • ReceiverpolynomialP(x)+E(x)

– E(x)=0impliesnoerrors

  • Divide(P(x)+E(x))byC(x);remainderzeroif:

– E(x)waszero(noerror),or – E(x)isexactlydivisiblebyC(x)

slide-5
SLIDE 5

5

Spring2002 CS461 13

SelectingC(x)

  • Allsingle-biterrors,aslongasthexk andx0 termshave

non-zerocoefficients.

  • Alldouble-biterrors,aslongasC(x)containsafactorwith

atleastthreeterms

  • Anyoddnumberoferrors,aslongasC(x)containsthe

factor(x +1)

  • Any‘burst’error(i.e.,sequenceofconsecutiveerrorbits)

forwhichthelengthoftheburstislessthank bits.

  • Mostbursterrorsoflargerthank bitscanalsobedetected
  • SeeTable2.6onpage102forcommonC(x)

Spring2002 CS461 14

InternetChecksumAlgorithm

  • Viewmessageasasequenceof16-bitintegers;sumusing

16-bitones-complementarithmetic;takeones-complement

  • ftheresult.

u_short cksum(u_short*buf, int count) { registeru_longsum=0; while(count--) { sum+=*buf++; if(sum&0xFFFF0000) { /*carryoccurred,sowraparound*/ sum&=0xFFFF; sum++; } } return~(sum&0xFFFF); }

Spring2002 CS461 15

Acknowledgements&Timeouts

Sender Receiver Frame ACK Timeout Time Sender Receiver Frame ACK Timeout Frame ACK Timeout Sender Receiver Frame ACK Timeout Frame ACK Timeout Sender Receiver Frame Timeout Frame ACK Timeout (a) (c) (b) (d)

slide-6
SLIDE 6

6

Spring2002 CS461 16

Stop-and-Wait

  • Problem:keepingthepipefull
  • Example

– 1.5Mbpslinkx 45msRTT=67.5Kb(8KB) – 1KBframesimplies1/8thlinkutilization

Sender Receiver

Spring2002 CS461 17

SlidingWindow

  • Allowmultipleoutstanding(un-ACKed)frames
  • Upperboundonun-ACKedframes,calledwindow

Sender Receiver Time

… …

Spring2002 CS461 18

SW:Sender

  • Assignsequencenumbertoeachframe(SeqNum)
  • Maintainthreestatevariables:

– sendwindowsize(SWS) – lastacknowledgmentreceived(LAR) – lastframesent(LFS)

  • Maintaininvariant:LFS - LAR <=SWS
  • AdvanceLAR whenACKarrives
  • BufferuptoSWS frames

≤SWS

LAR LFS

… …

slide-7
SLIDE 7

7

Spring2002 CS461 19

SW:Receiver

  • Maintainthreestatevariables

– receivewindowsize(RWS) – largestframeacceptable(LFA) – lastframereceived(NFE)

  • Maintaininvariant:LFA - LFR <=RWS
  • FrameSeqNum arrives:

– ifLFR <SeqNum <=LFA accept – ifSeqNum <=LFR orSeqNum >LFA discarded

  • SendcumulativeACKs

≤ RWS

NFE LFA

… …

Spring2002 CS461 20

SequenceNumberSpace

  • SeqNum fieldisfinite;sequencenumberswraparound
  • Sequencenumberspacemustbelargerthennumberof
  • utstandingframes
  • SWS <=MaxSeqNum-1 isnotsufficient

– suppose3-bitSeqNum field(0..7) – SWS=RWS=7 – sendertransmitframes0..6 – arrivesuccessfully,butACKslost – senderretransmits0..6 – receiverexpecting7,0..5,butreceivessecondincarnationof0..5

  • SWS <(MaxSeqNum+1)/2 iscorrectrule
  • Intuitively,SeqNum “slides”betweentwohalvesof

sequencenumberspace

Spring2002 CS461 21

ConcurrentLogicalChannels

  • Multiplex8logicalchannelsoverasinglelink
  • Runstop-and-waitoneachlogicalchannel
  • Maintainthreestatebitsperchannel

– channelbusy – currentsequencenumberout – nextsequencenumberin

  • Header:3-bitchannelnum,1-bitsequencenum

– 4-bitstotal – sameasslidingwindowprotocol

  • Separatesreliabilityfrom order