Presentation on theme: "CS 453 Computer Networks Lecture 12 Layer 2 – Data Link Layer Protocols."— Presentation transcript:
CS 453 Computer Networks Lecture 12 Layer 2 – Data Link Layer Protocols
Error Detection There are two forms of error control Error Detection Error Correction Both involve adding extra bits to the communication stream Error detection - sensing and handling errors – resend, drop, … Error correction – sensing and correcting errors with available information
Error Detection Think about this – What is the simplest way to detect errors in transmitted frames? Send each frame twice Compare, if different – probable error Is this efficient? Why? Is it fool-proof? What kind of errors could slip by?
Error Detection You’re right (I hope) It is not efficient It reduces effective data rate in half Repetitive errors to the same bit sequences would slip through Consistently dropping the first five bits
Error Detection Parity bits Simple form of error detection Even or odd parity For 7 bits add an 8 th bit such that the number of 1 bits is an even number (even parity).. …or odd (odd parity) If parity is even and the receiver gets a byte with an odd number of 1s, then error 10100101 Parity bit Data bits
Error Detection Parity bits Very efficient – adds one bit per 7 bits Not very powerful – can detect 1 bit errors
Error Detection Two Dimensional Parity Imagine data stream as matrix 6 byte data stream Add parity bit per byte (simple parity) Add a parity byte where each bit is a parity bit for that bit position across the bytes in the frame From Peterson & Davie (2003) pg. 90
Error Detection Two Dimensional Parity Fairly efficient Add 14 bits of redundant information to a 42 bit data stream Fairly powerful Can detect all 1, 2 and 3 bit errors Can detect some 4 bit errors Why can it detech multibit errors Can 2D parity be used to correct errors?
Error Detection Internet Checksum Add the words in a data stream Suppose you have a stream of 16 bit integers Add them using ones complement arithmetic Sender calculates checksum …then sends data stream+checksum Receiver receives data stream+checksum Receive calculates new checksum on received data stream Compares it to the received checksum If match – probably no error If no match – probably error
Error Detection Internet Checksum Very efficient Only a few bits for a very long data stream Fairly weak For example, a dropped bit in one word and a spuriously added bit in another word would not be detected - would result in same ckecksum Easy to implement in hardware or software
Error Detection CRC – Cyclic Redundancy Check More generally knows an polynomial code CRC data stream… D: data bit from senderR: CRC bit d bitsr bits
Error Detection CRC – Cyclic Redundancy Check Sender and Receiver must agree on a r+1 bit pattern – referred to as G Some things to consider CRC calculations are done with base 2 arithmetic addition/subtraction done with XOR multiplication/division done with left/right register shifts
Error Detection CRC – Cyclic Redundancy Check What to use for R D * 2 r XOR R = nG says that D * 2 r XOR R is an even multiple of G …or divisible with no remainder If we XOR R to both sides of above D * 2 r = nG XOR R If we divide D * 2 r by G the remainder is R R = remainder(D * 2 r /G) Based on Kurose & Ross, Computer Networking: a top down structured approach using the Internet (2005) pg. 428
Error Detection CRC – Cyclic Redundancy Check consider – original message D D = 10011010 left shift 3 bit positions (multiply) Divide by G Remainder = R for CRC check if R is subtracted from D… D-R is evenly divisible by G If receiver gets D,R where (D-R ) /G has remainder there is an error from: Peterson & Davie (2003) pg.95
Error Detection CRC – Cyclic Redundancy Check CRC is very powerful Can detect multibit errors Can detect burst errors < r+1 bits So where does G come from? Mathematics There are lots of codes, predetermined For example- CRC-32 10000010011000010001110110110111 IEEE