0% found this document useful (0 votes)
27 views

Chapter-4 Error Detection

Uploaded by

Maryam Mousa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Chapter-4 Error Detection

Uploaded by

Maryam Mousa
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 52

Chapter 4

Error Detection
and Correction
• Types of Errors
• Detection
• Correction
Basic concepts
 Networks must be able to transfer data from
one device to another with complete accuracy.
 Data can be corrupted during transmission.
 For reliable communication, errors must be
detected and corrected.
 Error detection and correction
are implemented either at the data link
layer or the transport layer of the OSI
model.
Types of Errors
Single-bit error
• Single bit errors occur when one bit in the PDU* is
changed from 0 to 1 or from 1 to 0.

* PDU: Protocol Data Unit (e.g. a “frame” in layer 2, or a “packet” in layer 3, etc.)
• Single bit errors are least likely to occur in serial
data transmission because the noise must have a
very short duration which is very rare.
• They can happen in parallel transmission.
Example:
 If data is sent at 1Mbps then each bit lasts only
1/1,000,000 sec. or 1 μs.
 For a single-bit error to occur, the noise must have a
duration of only 1 μs, which is very rare.
Multiple-bit error

The term multiple-bit error means that two or


more non-consecutive bits in the PDU have
changed from 1 to 0 or from 0 to 1.
Burst error

The term burst error means that two or more bits in


the PDU have changed from 1 to 0 or from 0 to 1.
Burst error is most likely to happen in serial
transmission since the duration of noise is
normally longer than the duration of a bit.
The number of bits affected depends on the data
rate and duration of noise.
Example:
If data is sent at rate = 1Kbps then a noise of 1/100 sec
can affect 10 bits.(1/100*1000)

If same data is sent at rate = 1Mbps then a noise of


1/100 sec can affect 10,000 bits.(1/100*106)
• Question:
• Assume continuous data is transferred at a rate of
5 Mbps. During transmission, noise affected the
signal for a duration of 15 ms. How many bits are
affected?
• Answer:
• 5 Mbps = 5,000,000 bps (bits / second)
• Noise: 15 ms  0.015 seconds
• 15 ms noise would affect:
5,000,000 * 0.015 = 75,000 bits
Error detection
Error detection means to decide whether the
received data is correct or not without having a
copy of the original message.

Error detection uses the concept of redundancy,


which means adding extra bits for detecting
errors at the destination.
Redundancy
Four types of redundancy checks are used
in data communications
Vertical Redundancy Check
VRC
VRC Performance

It can detect single bit error


It can detect burst errors only if the total
number of errors is odd.
VRC Examples
• Which of the below PDUs have an error:
– 10110100
• No Error
– 11001011
• Error
– 10101010
• No Error
– 01110011
• Error
Longitudinal Redundancy Check
LRC
LRC Performance
LCR increases the likelihood of detecting
burst errors.
If two bits in one data units are damaged
and two bits in exactly the same positions in
another data unit are also damaged, the LRC
checker will not detect an error.
LRC Examples
• Create parity bits:
– 11001011 - 11010010 - 10101010
• 10110011
– 01011111 - 11110110 - 10100000
• 00001001
– 10101010 – 10110011 - 11001011
• 11010010
VRC and LRC (combination)
Data to be transmitted (before checksum):
0101001 0111001 1011101 1100111
Example 2:
Data to be transmitted (before checksum):
1001110 0101011 0010101 0101100
LRC+VRC combo example
• Create parity bits:
– 1100-1011-1110-0101
• 0 1100
• 1 1011
• 1 1110
• 0 0101
• 0 1100
• Data to be transferred:
– 01100-01100-11011-11110-00101
Cyclic Redundancy Check
CRC
Cyclic Redundancy Check
• Given a k-bit frame or message, the
transmitter generates an n-bit sequence,
known as a frame check sequence (FCS), so
that the resulting frame, consisting of (k+n)
bits, is exactly divisible by some
predetermined number.
• The receiver then divides the incoming
frame by the same number and, if there is
no remainder, assumes that there was no
error.
Binary Division
Binary Division
Polynomial
Polynomial and Divisor
FYI Standard Polynomials
Checksum
At the sender
The unit is divided into k sections, each of n
bits.
All sections are added together using 1’s
complement to get the sum.
The sum is complemented and becomes the
checksum.
The checksum is sent with the data
Checksum example - Sender
• Consider the data unit to be transmitted is:
– 10011001111000100010010010000100
• Consider 8-bit checksum is used
Checksum example - Sender (contd.)
Checksum example - Sender (contd.)
At the receiver
The unit is divided into k sections, each of n
bits.
All sections are added together using 1’s
complement to get the sum.
The sum is complemented.
If the result is zero, the data is accepted:
otherwise, it is rejected.
Checksum example - Receiver
• Consider the data received is:
– 1001100111100010001001001000010011011010
• Consider 8 bit checksum is used
Checksum example – Receiver
(contd.)
• Step 1: Divide into 8-bit segments:
– 10011001-11100010-00100100-
10000100-11011010
• Step 2: Calculate the sum of all segments
(including checksum)
–  1011111101  >8 bits? Repeat step 1
– 11111101 + 10 = 11111111
Checksum example – Receiver
(contd.)
• Step 3: Calculate 1’s complement:
– 11111111  00000000
– If the result is 0: Data has no error
– If the result is NOT 0: Data has ERROR
Performance
The checksum detects all errors involving an
odd number of bits.
It detects most errors involving an even number
of bits.
If one or more bits of a segment are damaged
and the corresponding bit or bits of opposite
value in a second segment are also damaged, the
sums of those columns will not change, and the
receiver will not detect a problem.
Error Correction
It can be handled in two ways:
1) receiver can have the sender retransmit the
entire data unit.
2) The receiver can use an error-correcting
code, which automatically corrects certain
errors.
Single-bit error correction
To correct an error, the receiver reverses the value
of the altered bit. To do so, it must know which bit
is in error.
We need to add redundancy bits:
• Let data bits = m
• Redundancy bits = r
Total message sent = m+r
The value of r must satisfy the following relation:
2r ≥ m+r+1
Error Correction
Hamming Code
Hamming Code

https://www.geeksforgeeks.org/hamming-code-in-computer-network/
Hamming Code
Hamming Code
Example of Hamming Code
Single-bit error
Error
Detection

You might also like