0% found this document useful (0 votes)
13 views34 pages

Lecture 12 Error Detection & Correction

The document discusses flow control and error detection in computer networks, focusing on Automatic Repeat Requests (ARQs) and various error detection methods like parity checks, checksums, and cyclic redundancy checks (CRC). It explains three ARQ protocols: Stop & Wait, Stop n Go Back, and Selective Repeat, along with their mechanisms for handling errors. Additionally, it outlines the limitations of single and two-dimensional parity checks, and details the steps involved in CRC for error detection.

Uploaded by

Noor Noora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views34 pages

Lecture 12 Error Detection & Correction

The document discusses flow control and error detection in computer networks, focusing on Automatic Repeat Requests (ARQs) and various error detection methods like parity checks, checksums, and cyclic redundancy checks (CRC). It explains three ARQ protocols: Stop & Wait, Stop n Go Back, and Selective Repeat, along with their mechanisms for handling errors. Additionally, it outlines the limitations of single and two-dimensional parity checks, and details the steps involved in CRC for error detection.

Uploaded by

Noor Noora
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 34

Computer Networks

Flow Control, Error Detection


Automatic Repeat Requests
(ARQs)
 It is used in Data Link and Transport Layers
This is a protocol for error control over unreliable or noisy network connections. For each
frame sent an acknowledgement is sent from the receiver to indicate that the frame has been
successfully used.

There are 3 versions of ARQ:


 Stop & Wait
 Stop n go back
 Selective repeat
Stop and Wait
The sender sends the packet and waits for
the ACK (acknowledgement) of the
packet. Once the ACK reaches the sender,
it transmits the next packet in row. If the
ACK is not received, it re-transmits the
previous packet again.
Stop n, Go back
The sender sends N packets which
is equal to the window size. Once
the entire window is sent, the
sender then waits for a cumulative
ACK to send more packets. On the
receiver end, it receives only in-
order packets and discards out-of-
order packets. As in case of packet
loss, the entire window would be
re-transmitted.
Selective Repeat
The sender sends packet of
window size N and the receiver
acknowledges all packet
whether they were received in
order or not. In this case, the
receiver maintains a buffer to
contain out-of-order packets
and sorts them. The sender
selectively re-transmits the lost
packet and moves the window
forward.
Error Detection
 Data can be corrupted during transmission. For reliable
communication, error 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
 Errors can be classified into two categories:
• Single-Bit Error
• Burst Error
Single-Bit Error

• The only one bit of a given data unit is changed from 1 to 0 or from 0 to 1.
• Single-Bit Error mainly occurs in Parallel Data Transmission. For example, if
eight wires are used to send the eight bits of a byte, if one of the wire is noisy,
.then single-bit is corrupted per byte
Burst Error
• The two or more bits are changed from 0 to 1 or from 1 to 0 is known
as Burst Error.
• The Burst Error is determined from the first corrupted bit to the last
corrupted bit.
• Burst Errors are most likely to occur in Serial Data Transmission.
Single Parity check
Blocks of data from the source are subjected to a check bit or parity bit generator form,
where a parity of :
 1 is added to the block if it contains odd number of 1’s, and
 0 is added if it contains even number of 1’s

This scheme makes the total number of 1’s even, that is why it is called even parity checking.
Data word Received Case
10111 10111 Correct
10111 10011 Single-bit change

10111 10110 Single-bit change

10111 00110 Two bits Change

10111 01011 Three bits Change


Drawbacks Of Single Parity Checking

 It can only detect single-bit errors which are very rare.


 If two bits are interchanged, then it cannot detect the errors.
 It can detect odd errors
Two-dimensional Parity check
Performance can be improved by using Two-Dimensional Parity Check which
organizes the data in the form of a table and Parity check bits are calculated for
each row, and columns, then both are sent along with the data. At the receiving
end these are compared with the parity bits calculated on the received data.
Two-dimensional Parity check…
Two-dimensional Parity check…

Drawbacks Of 2D Parity Check


 If two bits in one data unit are corrupted and two bits exactly the same position in another
data unit are also corrupted, then 2D Parity checker will not be able to detect the error.
 This technique cannot be used to detect the 4-bit errors or more in some cases.
Practice

1101
0111
1001
0010
Checksum
It is divided into two parts:
1. Checksum Generator:
A Checksum is generated at the sending side. Checksum generator subdivides the data into
equal segments of n bits each, and all these segments are added together by using one's
complement arithmetic. The sum is complemented and appended to the original data, known
as checksum field. The extended data is transmitted across the network.
 The Sender follows the given steps:
 The block unit is divided into k sections, and each of n bits.
 All the k sections are added together by using one's complement to get the sum.
 The sum is complemented and it becomes the checksum field.
 The original data and checksum field are sent across the network.
Checksum…
2. Checksum Checker:

 A Checksum is verified at the receiving side. The receiver subdivides the incoming
data into equal segments of n bits each, and all these segments are added together, and
then this sum is complemented. If the complement of the sum is zero, then the data is
accepted otherwise data is rejected.
Checksum…
Checksum Practice

Byte # Value (Decimal) Binary


1 50 00110010
2 100 01100100
3 150 10010110
4 200 11001000
Cyclic redundancy check (CRC)

 Unlike checksum which is based on addition, CRC is based on binary division.


CRC Generator:

 CRC generator is an algebraic polynomial represented as a bit pattern.


 Bit pattern is obtained from the CRC generator using the following rule:

The power of each term gives the position of the bit and the coefficient gives the value of
the bit.
Cyclic redundancy check (CRC)
Important Notes

If the CRC generator is chosen according to the above rules, then;


 CRC can detect all single-bit errors
 CRC can detect all double-bit errors provided the divisor contains at least three logic 1’s.
 CRC can detect any odd number of errors provided the divisor is a factor of x+1.
 CRC can detect all burst error of length less than the degree of the polynomial.
 CRC can detect most of the larger burst errors with a high probability.
Steps Involved
 Error detection using CRC technique involves the following steps.

Step 01: Calculation of CRC At Sender Side:


 A string of n 0’s is appended to the data unit to be transmitted.
 Here, n is one less than the number of bits in CRC generator.
 Binary division is performed of the resultant string with the CRC generator.
 After division, the remainder so obtained is called as CRC.
 It may be noted that CRC also consists of n bits.
Step 02: Appending CRC To Data Unit
At sender side,
 The CRC is obtained after the binary division.
 The string of n 0’s appended to the data unit earlier is replaced by the CRC remainder.

Step 03: Transmission To Receiver

 The newly formed code word (Original data + CRC) is transmitted to the receiver.
Step 04: Checking at Receiver Side

 The transmitted code word is received.


 The received code word is divided with the same CRC generator.
 On division, the remainder so obtained is checked.
Two Possibilities
The following two cases are possible;

Case 01: Remainder = 0

If the remainder is zero,


 Receiver assumes that no error occurred in the data during the transmission.
 Receiver accepts the data.

Case 02: Remainder ≠ 0

If the remainder is non-zero,


 Receiver assumes that some error occurred in the data during the transmission.
 Receiver rejects the data and asks the sender for retransmission.
Example of CRC
A bit stream 1101011011 is transmitted using the standard CRC method. The generator
polynomial is x4+x+1. What is the actual bit string transmitted?

Solution:

 The generator polynomial G(x) = x4 + x + 1 is encoded as 10011.


 Clearly, the generator polynomial consists of 5 bits.
 So, a string of 4 zeroes is appended to the bit stream to be transmitted.
 The resulting bit stream is 11010110110000.
We can conclude from here,
 The remainder obtained on division is a non-zero value.
 This indicates to the receiver that an error occurred in the data during the transmission.
 Therefore, receiver rejects the data and asks the sender for retransmission.
CRC Practice

•Data: 11010011101100
•Generator Polynomial (divisor): 1011 → degree = 3

You might also like