Error Detection
Error Detection
Computer Networks
Data Link Layer, Error Detection
Munir ahmad
2
What Goes Wrong in the Network?
Reliability
■ Most important function that network
provide
■ How networks can fail?
■ Bit-level Vs Burst errors (electrical
interference)
■ Packet-level errors (congestion)
■ distinction between lost and late packet
■ Link and node failures
■ distinction between broken and flaky link
3
Why error detection and
correction
■ During data transmission bits are subject to
unpredictable changes because of interference
■ Attenuation, distortion and noise are the main
cause of random bit errors because it can
change the shape of a signal
■ This clearly emphasizes the need for error
detection and correction, and is one of the
service provided by data link layer
4
Single Bit Error
5
Burst Error of Length 8
If the bandwidth of a channel is 1Gbps then for how much duration the error should last?
6
■ Redundancy
■ To detect or correct errors, we need to send extra
(redundant) bits with data.
■ Detection versus Correction
■ In error detection, looking only to see if any error has
occurred. Simple yes or no answer.
■ In error correction, need to know the exact number of
bits that are corrupted and more importantly their
location in the message
■ Coding (block/convolution)
■ Redundancy is achieved through various coding
schemes. The sender adds redundant bits through a
process that receiver checks the relationships between
the two sets of bits to detect errors.
7
BLOCK CODING
8
Process of error detection in block coding
9
A code for error detection
Assume k=2, n=3
11
A code for error correction
Assume k=2, n=5
1. Comparing the received codeword with the first codeword in the table (01001
versus 00000), the receiver decides that the first codeword is not the one that
was sent because there are two different bits.
2. By the same reasoning, the original codeword cannot be the third or fourth
one in the table.
3. The original codeword must be the second one in the table because this is the
only one that differs from the received codeword by 1 bit. The receiver
replaces 01001 with 01011 and consults the table to find the dataword 01.
12
Figure XORing of two single bits or two words
13
Hamming Distance
■ The Hamming distance between two words
(of the same size) is the number of
differences between the corresponding bits.
■ Represented as d (x, y) for two words x and y
■ Found by applying XOR operation on the two
words and counting number of 1s in the
result
14
Example
15
The minimum Hamming distance is the
smallest Hamming distance between
all possible pairs in a set of words.
16
Example
17
Example
Solution
We first find all the Hamming distances.
18
Error detection techniques
■ Popular techniques
■ Simple Parity check
■ Two-dimensional Parity check
■ Checksum
■ Cyclic redundancy check
19
Simple Parity-Checking
■ Simple Parity Checking or One-dimension
Parity Check
■ The common, simple and least expensive
mechanism
■ In this technique, a redundant bit called
parity bit, is appended to every data unit so
that the number of 1s in the unit (including
the parity becomes even)
20
Even parity checking scheme
21
Possible 4-bit data words and corresponding code words
Decimal Value Data Block Parity bit Code word
0 0000 0 00000
1 0001 1 00011
2 0010
3 0011
4 0100
5 0101
6 0110
7 0111
8 1000
9 1001
10 1010
11 1011
12 1100
13 1101
14 1110
15 1111 22
performance
■ Can detect all single bit errors
■ Can detect burst errors if the number of bits
in error is odd
■ Cannot detect if even number of bits are
corrupted
23
Two-dimensional Parity check
■ Performance can be improved by using
two-dimensional parity check, which
organizes the block of bits in the form of a
table
■ Parity check bits are calculated for each row,
which is equivalent to a simple parity check
bit
■ Parity check bits are also calculated for all
columns then both are sent along with the
data
■ At the receiving end these are compared
with the parity bits calculated on the received 24
Figure Two-dimensional parity-check code
25
Figure Two-dimensional parity-check code
26
performance
■ Extra overhead is traded for better error
detection capability
■ It can detect many burst errors but not all
27