View
217
Download
0
Category
Preview:
Citation preview
CS 453CS 453Computer NetworksComputer Networks
Lecture 12Lecture 12
Layer 2 – Data Link LayerLayer 2 – Data Link Layer
ProtocolsProtocols
Error Detection
There are two forms of error control Error Detection Error Correction
Both involve adding extra bits to the communication streamError 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 DetectionParity bits
Simple form of error detection Even or odd parity For 7 bits add an 8th 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
1 0 1 0 0 1 0 1
Parity bitData bits
Error DetectionParity bits Very efficient – adds one bit per 7 bits Not very powerful – can detect 1 bit errors
Error DetectionTwo 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
1011110 1
1101001 0
0101001 1
1011111 0
0110100 1
0001110 1
1111011 0
Paritybits
Paritybyte
Data
From Peterson & Davie (2003) pg. 90
Error DetectionTwo Dimensional Parity Fairly efficient
Add 14 bits of redundant information to a 42 bit data stream
Fairly powerfulCan 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 DetectionInternet Checksum
Add the words in a data streamSuppose 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 DetectionInternet 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 DetectionCRC – Cyclic Redundancy Check
More generally knows an polynomial code
CRC data stream…
D: data bit from sender R: CRC bit
d bits r bits
Error DetectionCRC – 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
arithmeticaddition/subtraction done with XOR
multiplication/division done with left/right register shifts
Error DetectionCRC – Cyclic Redundancy Check
What to use for R D * 2r XOR R = nG
says that D * 2r XOR R is an even multiple of G
…or divisible with no remainder If we XOR R to both sides of above
D * 2r = nG XOR R If we divide D * 2r by G the remainder is R
R = remainder(D * 2r /G)
Based on Kurose & Ross, Computer Networking: a top down structured approach using the Internet (2005) pg. 428
Error DetectionCRC – Cyclic Redundancy Check
consider – original message D
D = 10011010left 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
Generator 11011111100110011010000 Message1101
10011101
10001101
10111101
11001101
10001101101 Remainder
Error DetectionCRC – Cyclic Redundancy CheckCRC 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
Recommended