8
Computer Networks Lecture 27: Error Control Error Control Errors are unavoidable, caused by noise on channel: electrical interference, thermal noise, cosmic rays, etc. Three kinds of transmission errors: 1. sent signal destroyed (doesn’t receive data) 2. sent signal changed (received wrong data) 3. spurious signal created (received random data) Error control: receiver detects and corrects lost or corrupted data 1. error detecting code 2. error correcting code (ECC) or forward error correction (FEC) Error Control No error control method is fool-proof Trade-offs between alternative methods: complexity of info computation, bandwidth transmission overhead, and degree of protection (# of bit errors that can be detected/corrected) Not often used for mostly reliable links, e.g., fiber, but useful for unreliable links such as wireless also used at the transport layer (the Internet is an unreliable “link”) Field: Information Theory Introduction to Coding Theory Fundamental issues in information and coding theory: 1. How can we tell when data (transmitted or stored) has been corrupted? 2. How to recover the original data? Example alternatives: do nothing: loss may not be discernable, e.g., concealed by interpolation send/store each bit 100 times, majority value accepted as original value parity bit: append one single parity bit at the end of message/ storage

Error Control - University of Michigan · Network Coding Instead of treating data in discrete, inviolable chunks, network nodes may recombine several packets into one or more output

  • Upload
    vankiet

  • View
    215

  • Download
    0

Embed Size (px)

Citation preview

Computer Networks

Lecture27:

ErrorControl

ErrorControl

Errorsareunavoidable,causedbynoiseonchannel:

• electricalinterference,thermalnoise,cosmicrays,etc.

Threekindsoftransmissionerrors:

1.  sentsignaldestroyed(doesn’treceivedata)2.  sentsignalchanged(receivedwrongdata)

3.  spurioussignalcreated(receivedrandomdata)

Errorcontrol:receiverdetectsandcorrectslostor

corrupteddata

1.  errordetectingcode2.  errorcorrectingcode(ECC)or

forwarderrorcorrection(FEC)

ErrorControl

Noerrorcontrolmethodisfool-proof

Trade-offsbetweenalternativemethods:

•  complexityofinfocomputation,

•  bandwidthtransmissionoverhead,and

•  degreeofprotection(#ofbiterrorsthatcanbedetected/corrected)

Notoftenusedformostlyreliablelinks,e.g.,fiber,

butusefulforunreliablelinkssuchaswireless

• alsousedatthetransportlayer(theInternetisanunreliable“link”)

Field:InformationTheory

IntroductiontoCodingTheory

Fundamentalissuesininformationandcodingtheory:

1.  Howcanwetellwhendata(transmittedorstored)hasbeen

corrupted?

2.  Howtorecovertheoriginaldata?

Examplealternatives:

• donothing:lossmaynotbediscernable,e.g.,concealedby

interpolation

•  send/storeeachbit100times,majorityvalueacceptedas

originalvalue

• paritybit:appendonesingleparitybitattheendofmessage/

storage

IntroductiontoCodingTheory

Maintoolandtrade-off:

• bysendingadditional,redundantinformation,wecan

detect,andperhapscorrect,transmissionerrors

•  themoreredundancy,themoreeffectiveinerrordetection/

correction,butthelessefficientinbandwidthusage

Generalidea:

• sendercomputessomeinfofromdata

• sendersendsthisinfoalongwithdata

• receiverdoesthesamecomputation

andcomparesitwiththesentinfo

Exampleserrordetectingcode:

•  paritycheck,checksum,cyclicredundancycheck(CRC)

Transmitextra

(redundant)

information

Useredundant

informationto

detecterrors

ParityCheck

• usesanextrabit(paritybit)forerrorchecking• evenparity:totalnumberof1bits(incl.theparitybit)isanevennumber

• oddparity:totalnumberof1bitsisodd•  single-bitparityexamples:

0100101,even-paritybit=0101101,even-paritybit=• whathappenswhenanerrorisdetected?

•  discarddataand,ifreliabilityisrequired,havesenderretransmit

• problem:cannotdetectevennumberofflippedbits

Checksum

Sendertreatsdataasasequenceof16-bitintegersandcomputestheir(1’scomplement)sum

• transmitthesumalongwiththepacket

• example:16-bitchecksum

•  thestring“Helloworld.”hasanASCIIrepresentationof

[48 65 6C 6C 6F 20 77 6F 72 6C 64 2E]•  checksum:4865 + 6C6C + 6F20 + 776F + 726C + 642E + carry = 71FC

Advantages:

•  easeofcomputation(onlyrequiresaddition)

•  smallamountofadditionalinfotocarry:

oneadditional16-bitor32-bitinteger

UsedbyTCPandUDP

InternetChecksumExample

One’scomplementarithmetic:whenaddingnumbers,a

carryoutfromthemostsignificantbitisaddedbacktothe

result

Example:addtwo16-bitintegers

Incrementalupdateofchecksum[RFC1624]:~C’=(~C + m + ~m’),ma16-bitfieldoftheheader

1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 1 01 1 1 0 1 0 1 0 1 0 1 0 1 0 1 0 1

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

1 1 0 1 1 1 0 1 1 1 0 1 1 1 1 0 01 0 1 0 0 0 1 0 0 0 1 0 0 0 0 1 1

wraparound

1’scomplementsum

1’scomplementofsum

(InternetChecksum)

Checksum:Disadvantage

With16-bitchecksum,1in64Kcorruptedpacketwill

notbedetected(probabilityofarandom16-bitnumbermatchingthechecksumofacorrupted

packetis1/216)

⇒ undercurrentInternetconditions(errorrateetc.),1corruptedpacketisacceptedininevery300M packets!

MeasuredonabusyNFSserver

thathasbeenup40days[Mogul92]:

Layer #errorsdetected ~#pkts

ethernet (CRC) 446 1.7x108

IP 14 1.7x108

UDP 5 1.4x108

TCP 350 3x107

CyclicRedundancyCheck

Goalofanyerrordetection/correctioncode:

maximizeprobabilityofdetectingerrorwithminimal

redundantinfo

32-bitCRCprotectsagainstmostbiterrorsin

messagesthousandsofbyteslong,alsousedin

storagesystems(CD,DVD)

CRCisbasedonfinitefieldsmath

CyclicRedundancyCheck

Considerabinarymessageasarepresentationof

ann-degreepolynomial,withthecoefficientof

eachtermbeing1or0dependingonthebitinthemessage,withthemostsignificant(leftmost)bit

representingthehighestdegreeterm

•  forexample:1011represents1x3 + 0x2 + 1x1 + 1x0 = x3 + x + 1

An m-bitmessagerepresentsapolynomialof m-1degree

PolynomialArithmetic

Youcandivideonesuchpolynomialbyanotherof

lowerorequaldegreebydividingthebinary

representationofthepolynomials,e.g.,todivide

x5+x3+x2+x byx3+1,divide101110by1001

Polynomialarithmeticisdoneusingmodulo-2arithmetic,withnocarryandborrow:

1+1 = 0+0 = 0 and 1+0 = 0+1 = 1,e.g.,

10011011 11110000 0101010111001010 + 10100110 - 10101111 ---------------- --------------- ---------------01010001 01010110 11111010

NotethatbothadditionandsubtractionareidenticaltoXOR

ConstructingCRC

Let’scallthepolynomialtobedividedTandthedivisor/generatorpolynomial G

LettbethenumberofbitsinTandr +1bethenumber

ofbitsinG,t ≥ r +1

Let’scalltheremainderofT/G,R;Risofrbits

Want:thepolynomialrepresentingthemessage(M,

notT,andnotthemessageitself)tobeexactlydivisible

byG⇒ifthereceiverdividesthemessagebyGand

theremainderisnot0,themessageiscorrupted

Observe:M = (T–R) isexactlydivisiblebyG,want M

ConstructingCRC

LetDbethemessagetobesent,e.g.,D = 101110

ConstructTasD•2r,i.e., Dshiftedleftby rbits,†

e.g.,r = 3,T =101110000

LetG = 1001,computeR,theremainder

ofT/G,bydoinglong-divisionwithmodulo-2arithmetic,R =011

ConstructM = (T–R) = (D•2r – R) = (D•2r XOR R)�=101110011;MisexactlydivisiblebyG

†Recall:multiplyinganumberby2isthesameasshiftingitleftby1bit

HowtoChooseG?

Letthestringofbiterrorsintroducedbe

representedbypolynomialE

ErrorwillnotbedetectedonlyifT+EisexactlydivisiblebyG

WantGthatmakesthisunlikely

HowtoChooseG?

What’sknown:

•  ifxrandx0

termshavenon-zerocoefficients,

Gcandetectallsingle-biterrors

• aslongasGhasafactorwithatleast3terms,

itcandetectalldouble-biterrors

• aslongasGcontainsthefactor(x+1),itcandetectanyoddnumberoferrors

• Gcandetectanyburst(sequenceof

consecutive)errorsoflength< rbits

Usually,youjustlookupacommonlyusedG• EthernetusesCRC-32• CRC-32’sG:100000100110000010001110110110111• CRC-CCITT’s G:10001000000100001

CRCHardwareImplementation

CRCcanbecheaplyimplementedinhardwareby

implementingthelong-divisiontocomputeRasacombinationoflinearfeedbackshiftregister(LFSR)and

XORgates,representingG:

•  the0-thtermofGoccupiestheleftmostbitoftheshiftregisters

•  eachXORgaterepresentsamodulo-2additioninG•  themessageisfedintothecircuitmostsignificant(leftmost)bitfirst

•  eachbitofthemessagecausesthecurrentcontentoftheshift

registerstobeshiftedrightbyonebit

• whenthemessageisexhausted,theshiftregisterscontainR•  forexample,computingCRCwithG = x2+1canbeimplementedas:

Peterson&Davie

ErrorCorrection

ErrorCorrectingCode(ECC)generallyrequiresmore

redundantbitsthanerrordetection

• knowninnetworkingasForwardErrorCorrection(FEC);

“forward”becauseerrorcorrectionishandled“inadvance”

beforeerrorsoccur

Itisusuallycheapertoretransmitcorrupteddata

thantotransmitredundantdataatalltimes

FECismostusefulwhen:

1.  linkisverynoisy,e.g.,wirelesslink

2.  retransmissionwilltaketoolong,e.g.,

•  satelliteandinter-planetarycommunication

•  deepspaceprobetransmission

•  real-timeaudio/videostreaming(relativelytoolong)

2DParityCheckasECC

• generatesbothahorizontalorrowparity

andaverticalorcolumnparity

• bothparityinfoissenttoreceiver•  receivercandetectandcorrectsingle-biterrors

• problem:cannotdetect

evennumberofflippedbits

PacketSwitchedNetwork

Informationistransportedthesamewayascarson

freeways:independentdatastreamsmayshare

resourcesbuttheinformationitselfisseparate

playingwithmodels ericsson

NetworkCoding

Insteadoftreatingdataindiscrete,inviolable

chunks,networknodesmayrecombineseveral

packetsintooneormoreoutputpackets

Receiptofinformationnolongermeansreceiving

specificpacketcontentbutreceivingsufficient

numberofindependentpackets

netmit

LinearNetworkCoding

Severalpacketsarelinearlyrecombinedinto

oneormoreoutputpackets,whereadditionand

multiplicationareperformedoverafinite/Galois

field,GF(2u)• additionisXOR

• multiplicationispolynomialmultiplicationmoduloa

chosenirreduciblepolynomialoverGF(2)•  canbeveryefficientlyimplementedusing

bitwiseoperationsor2logtablelookups(seehttp://www.cs.utsa.edu/~wagner/laws/FFM.html

andhttp://www.ee.unb.ca/cgi-bin/tervo/calc2.pl)

Example:ButterflyNetwork

Simplestcase:S1andS2wanttosendtoR1andR2• u = 1• GF(2) = {0, 1}• additionisXOR,decodingisalsoasimpleXOR

Withoutnetworkcoding Withnetworkcoding

UseCase:WirelessNetwork

Withoutnetworkcoding Withnetworkcoding

Inthesimplestcase:

• u = 1• GF(2) = {0, 1}• additionisXOR,decodingisasimpleXOR

SimpleXORParityPacket

XORoperationacrossnpackets• transmit1paritypacketforeveryndatapackets• if1innpacketislost,canfullyrecover

Perkinsetal.

SimpleXORParityPacket

DEMO

Disadvantages:

• deliverytoupper-layermustwaitforreceiptofalln+1packets• canfixonlyonelost/corruptedpacket

Tradeoff:largern•  lessbandwidth“wastage,”but

•  longerwaittocorrecterror,and

•  higherprobabilitythat2ormorepacketscanbelost

Alsobasedonpolynomialcodesoverfinitefields

Goodforcorrectingbursterrors

Withdedicatedhardware,canachieveover600Mbpsencoding/decodingthroughput

UsedinCD,DAT,DVD,Blu-ray,CompactFlash,

MPEG-2TS,DSL,RAID,WiMax,DVB,ATSC,the

Voyager,MarsPathfinder,Galileo,MarsRover,etc.

Formoreinfo,takeEECS554IntrotoDigitalCommunicationandCodingorreadLinandCostello

Reed-SolomonCode

A(n, k, 2s+1)codehas

k-unitmessage,whereunitisusuallyinbitorbyte

n-unitcodeword

2s-unitparitycandetect2serrorscancorrectserrorsGenerallycancorrectαerasuresandβerrorsifα+2β ≤ 2s

Polynomial-BasedCode

k 2s

n

PolynomialrepresentationoverGF(28):• message:“hello”• ASCIIdecimal:104 101 108 108 111 • polynomial:104x4 + 101x3 + 108x2 + 108x + 111

RS(20, 13)codeoverGF(28):13(k)messagebytes,

7(2s)paritybytes:cancorrectupto3errors• message:“Hello world!\0”

• codeword:“Hello world!\08D13F4F94310E5”

Reed-SolomonCodeExample

[Brown]

Message:

ALICE’S ADVENTURES IN WONDERLANDAlice was beginning to get very tired of sitting by her sister on the …

UsingRS(255, 223)codeoverGF(28):visualizeeachbyteasagrayscalepixelsuchthat

eachrowinimageisacodeword;messageis

encodedas:

Reed-SolomonCodeExample

[Brown]

SinceeachrowisaRS(255, 223)codeword,itcan

handleupto16bytes(orpixels)errorsperrow

Eachofthefollowingstilldecodes:

Reed-SolomonCodeExample

[Brown]

A.Brown’sslides:

http://www.cs.duke.edu/courses/spring11/cps296.3/

decoding_rs.pdf

R.Morelos-Zaragoza,TheECCPageandsourcecode:

http://www.eccpage.comandhttp://www.eccpage.com/rs.c

Linuxcode:

http://www.cs.fsu.edu/~baker/devices/lxr/http/source/linux/lib/

reed_solomon/reed_solomon.c

SchifraRScodelibrary:

http://www.schifra.com

Reed-SolomonImplementations