Professional Documents
Culture Documents
UNIT-2 Error Detection Methods
UNIT-2 Error Detection Methods
UNIT-2 Error Detection Methods
Kyung Hee
University
1
Error Detection and Correction
UNIT-2
Kyung Hee
University
2
Error Detection and Correction
Types of Errors
Error Detection
Error Correction
Kyung Hee
University
3
Error Detection and Correction
Kyung Hee
University
4
10.1 Type of Errors
Kyung Hee
University
5
Type of Errors(cont’d)
Single-Bit Error
It is when only one bit in the data unit has changed from
0 to 1,1 to 0
Kyung Hee
University
6
Type of Errors(cont’d)
Multiple-Bit Error
Kyung Hee
University
7
Type of Errors(cont’d)
Burst Error
Kyung Hee
University
8
It is actually to detect errors, we use the mechanism called Redundancy
It is the main technique to detect errors
Error Detection
Group of bits adding to end of data unit
Generating
function
Kyung Hee
University
9
Now reciever will check the message with the help of checking
function ,validating the sender message ,
Kyung Hee
University
10
Detection(cont’d)
Detection methods
Kyung Hee
University
11
Detection(cont’d)
Parity Check:
p D6 D5 D4 D3 D2 D1 DO
Kyung Hee
University
12
DRAW BACKS
1.it does not support all types of errors
2.it support even ,odd number of bits
3.it is not suitable for multiple errors
4.it is suitable for single bit error
Kyung Hee
University
13
Kyung Hee
University
14
Check sum
Check sum:
8 8 8 8
In the check sum error detection scheme
In the sender end ,the segments are added using 1’s complement arithmetic to
get the sum, the sum is complemented to get the check sum
Now check sum segment is sent along with the data segment
Kyung Hee
University
16
Suppose that the sender wants to send 4 frames each of 8 bits,
where the frames are 11001100, 10101010, 11110000 and
11000011.
After adding all the 4 frames, the sender complements the sum to get
the checksum, 11010011, and sends it along with the data frames.
Kyung Hee
University
19
CRC(Cyclic Redundancy Check)
CRC(Cyclic Redundancy Check)
Kyung Hee
University
20
Detection(cont’d)
CRC generator
uses modular-2 division.
po
Binary Division
in a
CRC Generator
Kyung Hee
University
21
Detection(cont’d)
Binary Division
in a
CRC Checker
Kyung Hee
University
22
Detection(cont’d)
Polynomials
CRC generator(divisor) is most often represented not as a
string of 1s and 0s, but as an algebraic polynomial.
Kyung Hee
University
23
Detection(cont’d)
A polynomial representing a divisor
Kyung Hee
University
24
Error Correction
Error Correction
Kyung Hee
University
25
>>A single additional bit can detect the error, but
cannot correct it.
For correcting the errors, one has to know the exact position of
the error. For example, if we want to calculate a single-bit
error, the error correction code will determine which one of
seven bits is in error. To achieve this, we have to add some
additional redundant bits.
Kyung Hee
University
27
Hamming Code
It can be applied to data units of any length.
Proposed by e.w.hamming.
D7 D6 D5 P4 D3 P2 P1
1 0 1 ? 0 ? ?
: 1,3,5,7,....
: 2,3,6,7,10,11.....
:4,5,6,7,12,13,14,15,20,21,22,23..
Kyung Hee
University
30
D7 D6 D5 P4 D3 P2 P1
1 0 1 ? 0 ? ?
P1 d3 d5 d7 | P2 d3 d6 d7 | P4 d5 d6 d7
P1 0 1 1 P2 0 0 1 P4 1 0 1
D7 D6 D5 P4 D3 P2 P1
1 0 1 0 0 1 0
Kyung Hee
University
31
The sender send the exact data of parity data,the
recievier will receive message or not
D7 D6 D5 P4 D3 P2 P1
Kyung Hee
University
32
Correecting of Errors
An error i s located by forming a 3 bit error number of out of 3
bit parity checker
P4 P2 P1
Similarly P2 & p4
After we have found the Error word .we find decimal value
D7 D6 D5 P4 D3 P2 P1
1 0 1 1 0 1 1
9
Kyung Hee
University
34
Detecting Errors:
Step-1: analyzing bits (1,3,5,7)
We have P1 D3 D5 D7-1 0 1 1
We have P2 D3 D6 D7-1 0 0 1
Kyung Hee
University
35
Step-3: analyzing bits (4,5,6,7)
We have P4 D5 D6 D7-1 1 0 1
Correcting Errors:
Error Word E= 1 0 1
Find the decimal value E=5 (which Shows 5th Bit Is In Error)
Kyung Hee
University
38
ELEMENTARY DATA LINK PROTOCOLS :
Kyung Hee
University
39
AN UNRESTRICTED SIMPLEX PROTOCOL
In order to appreciate the step by step development of efficient
and complex protocols we will begin with a simple but unrealistic
protocol. In this protocol:
The transmitting (Tx) and receiving (Rx) hosts are always ready
It is a data-link layer protocol which is used for transmitting the data
over the noiseless channels. It provides unidirectional data
transmission which means that either sending or receiving of data will
take place at a time. It provides flow-control mechanism but does not
provide any error control mechanism.
The idea behind the usage of this frame is that when the sender sends the frame then
he waits for the acknowledgment before sending the next frame.
Kyung Hee
University
42
Primitives of Stop and Wait Protocol
Sender side
Rule 2: Sender sends the next packet only when it receives the
acknowledgment of the previous packet.
Therefore, the idea of stop and wait protocol in the sender's side is very
simple, i.e., send one packet at a time, and do not send another packet
before receiving the acknowledgment.
Kyung Hee
University
43
Receiver side:
Therefore, the idea of stop and wait protocol in the receiver's side
is also very simple, i.e., consume the packet, and once the packet
is consumed, the acknowledgment is sent. This is known as a flow
control mechanism.
Kyung Hee
University
44
The above figure shows the working of the stop and wait protocol. If there
is a sender and receiver, then sender sends the packet and that packet is
known as a data packet. The sender will not send the second packet
without receiving the acknowledgment of the first packet. The receiver
sends the acknowledgment for the data packet that it has received. Once
the acknowledgment is received, the sender sends the next packet.
Kyung Hee
University
45
Disadvantages of Stop and Wait protocol
Suppose the sender sends the data and the data is lost. The receiver is
waiting for the data for a long time. Since the data is not received by the
receiver, so it does not send any acknowledgment. Since the sender does
not receive any acknowledgment so it will not send the next packet. This
problem occurs due to the lost data.
In this case, two problems occur:
Sender waits for an infinite amount of time for an acknowledgment.
Receiver waits for an infinite amount of time for a data.
Kyung Hee
University
46
2. Problems occur due to lost acknowledgment
Suppose the sender sends the data and it has also been received by the
receiver. On receiving the packet, the receiver sends the acknowledgment.
In this case, the acknowledgment is lost in a network, so there is no chance
for the sender to receive the acknowledgment. There is also no chance for
the sender to send the next packet as in stop and wait protocol, the next
packet cannot be sent until the acknowledgment of the previous packet is
received.
Kyung Hee
University
47
3.Problem due to the delayed data or acknowledgment
Suppose the sender sends the data and it has also been received by the
receiver. The receiver then sends the acknowledgment but the
acknowledgment is received after the timeout period on the sender's side.
As the acknowledgment is received late, so acknowledgment can be
wrongly considered as the acknowledgment of some other data packet.
Kyung Hee
University
48
Sender is sending data before reaching receiver, what sender will do
The sender has to wait particular time whenever time is out ,the sender will send again same data to the reciever
Stop and Wait ARQ (Automatic Repeat Request
Above 3 problems are resolved by Stop and Wait ARQ (Automatic Repeat
Request) that does both error control and
1 .Time Out:
Kyung Hee
University
49
before reaching the sender The Acknowledgement will be lost,particular time is out the sender will do again send data to the receiver,after
Working of Stop & Wait ARQ is almost like Stop & Wait
protocol, the only difference is that it includes some additional
components, which are:
Kyung Hee
University
52
1) Sender A sends a data frame or packet with sequence number 0
There is only one bit sequence number that implies that both
sender and receiver have buffer for one frame or packet only.
Stop & Wait ARQ is a 1-bit sliding window protocol where the
size ofHee
Kyung the sender window as well as the receiver window is 1
University
53
[minimum number of sequence numbers required = sender
window size + receiver window size]
Kyung Hee
University
54
What is Go-Back-N ARQ?
In Go-Back-N ARQ, N is the sender's window size. Suppose we say that Go-
Back-3, which means that the three frames can be sent at a time before
expecting the acknowledgment from the receiver.
If we have five frames and the concept is Go-Back-3, which means that the
three frames can be sent, i.e., frame no 1, frame no 2, frame no 3 can be sent
before expecting the acknowledgment of frame no 1.
Kyung Hee
University
56
Suppose there are a sender and a receiver, and let's assume that there
are 11 frames to be sent. These frames are represented as
0,1,2,3,4,5,6,7,8,9,10, and these are the sequence numbers of the
frames. Mainly, the sequence number is decided by the sender's
window size. But, for the better understanding, we took the running
sequence numbers, i.e., 0,1,2,3,4,5,6,7,8,9,10. Let's consider the
window size as 4, which means that the four frames can be sent at a
time before expecting the acknowledgment of the first frame.
Kyung Hee
University
57
Step 1: Firstly, the sender will send the first four frames to
the receiver, i.e., 0,1,2,3, and now the sender is expected to
receive the acknowledgment of the 0th frame.
Kyung Hee
University
58
Kyung Hee
University
59
After damage of data2 frame the reciever will not be accepted
data3,data4
The Reciever recieve the damage or error frame then send NACK
Lost ACK:
If sender does not recieve ACK With in a time,it resend all the
frame
Kyung Hee
University
61
Selective repeat protocol
Selective repeat protocol, also called Selective Repeat ARQ (Automatic
Repeat reQuest), is a data link layer protocol that uses sliding window
method for reliable delivery of data frames. Here, only the erroneous or
lost frames are retransmitted, while the good frames are received and
buffered.
It uses two windows of equal size: a sending window that stores the
frames to be sent and a receiving window that stores the frames receive by
the receiver
Selective Repeat protocol provides for sending multiple frames depending upon
the availability of frames in the sending window, even if it does not receive
acknowledgement for any frame in the interim. The maximum number of frames
that can be sent depends upon the size of the sending window .
Kyung Hee
University
62
Selective Repeat protocol retransmitted only damage or lost of
frames, it retransmitted only that frames which is damage or lost
Kyung Hee
University
63
Only selected has to be repeated to retransmit again you have to be
continue asuseually
Kyung Hee
University
64
The problem here is how to prevent the sender from flooding the
receiver.
A general solution to this problem is to have the receiver
provide some sort of feedback to the sender. The process
could be as follows: The receiver send an acknowledge
frame back to the sender telling the sender that the last
received frame has been processed and passed to the host;
permission to send the next frame is granted. The sender,
after having sent a frame, must wait for the acknowledge
frame from the receiver before sending another frame
Only selected has to be repeated to retransmit again you
have to be continue asusually
Kyung Hee
University
65
STOP & WAIT PROTOCOL
The sender sends one frame and waits for feedback from the
receiver. When the ACK arrives, the sender sends the next
frame
Kyung Hee
University
66
A SIMPLEX PROTOCOL FOR A NOISY CHANNEL
Kyung Hee
University
67
Kyung Hee
University
68
Sliding Window Protocol
In this technique, each frame has sent from the sequence number. The
sequence numbers are used to find the missing data in the receiver
end. The purpose of the sliding window technique is to avoid duplicate
data, so it uses the sequence number.
The term sliding window refers to the imaginary boxes to hold frames.
Sliding window method is also known as windowing.
Kyung Hee
University
69
Working Principle
Kyung Hee
University
70
Example
Kyung Hee
University
71
Kyung Hee
University
72
Go – Back – N ARQ