0% found this document useful (0 votes)
21 views25 pages

Unit 2 Part 2

The document discusses error detection and correction techniques in data transmission, categorizing errors into single-bit, multiple-bit, and burst errors. It outlines various error detection methods such as single parity check, two-dimensional parity check, checksum, and cyclic redundancy check (CRC), along with their advantages and disadvantages. Additionally, it covers error correction methods like backward and forward error correction, and introduces Hamming code for identifying and correcting errors in data transmission.

Uploaded by

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

Unit 2 Part 2

The document discusses error detection and correction techniques in data transmission, categorizing errors into single-bit, multiple-bit, and burst errors. It outlines various error detection methods such as single parity check, two-dimensional parity check, checksum, and cyclic redundancy check (CRC), along with their advantages and disadvantages. Additionally, it covers error correction methods like backward and forward error correction, and introduces Hamming code for identifying and correcting errors in data transmission.

Uploaded by

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

Error Detection:

When data is transmitted from one device to another device, the system does not guarantee whether
the data received by the device is identical to the data transmitted by another device. An Error is a
situationwhen the message received at the receiver end is not identical to the message transmitted.
Types of Errors:

Errors can be classified into two categories:


1. Single-Bit Error
2. Multiple-bit Error
3. Burst Error
Single-Bit Error:
Typically, only one bit of the frame received is corrupt, and the corrupted bit can be located
anywhere in the frame.

In the above figure, the message which is sent is corrupted as single-bit, i.e., 0 bit is changed to 1.

Multiple-Bit Error
More than one bit received in the frame is found to be corrupted. Refer to the below image for the
multiple-bit error
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.
Error Detecting Techniques:
The most popular Error Detecting Techniques are:
1. Single parity check
2. Two-dimensional parity check
3. Checksum
4. Cyclic redundancy check
Single Parity Check:
Simple-bit parity is a simple error detection method that involves adding an extra bit to a data
transmission. It works as:
 1 is added to the block if it contains an odd number of 1’s, and
 0 is added if it contains an even number of 1’s
This scheme makes the total number of 1’s even, that is why it is called even parity checking.

Advantages of Simple Parity Check


 Simple parity check can detect all single bit error.
 Simple parity check can detect an odd number of errors.
 Implementation: Simple Parity Check is easy to implement in both hardware and software.
 Minimal Extra Data: Only one additional bit (the parity bit) is added per data unit (e.g., per byte).
 Fast Error Detection: The process of calculating and checking the parity bit is quick, which
allows for rapid error detection without significant delay in data processing or communication.
 Single-Bit Error Detection: It can effectively detect single-bit errors within a data unit, providing
a basic level of error detection for relatively low-error environments.

Disadvantage:

 Only single-bit error is detected by this method, it fails in multi-bit error detection.
 It can not detect an error in case of an error in two bits.
Two-Dimensional Parity Check:
 Performance can be improved by using Two-Dimensional Parity Check which organizes the
datain the form of a table.

 For every row and column, parity check bits are calculated by a simple method of parity
check. Parity for both rows and columns is transmitted with the data sent from sender to
receiver. At the receiver’s side, parity bits are compared with the calculated parity of the
data received.

Disadvantages:
 If 2 bits are corrupted in 1 data unit and another data unit exactly at the same position is
corrupted then this method is not able to detect the error.
 Sometimes this method is not used for **detecting 4-bit **errors or more than 4-bit errors.

Checksum:

Checksum is an error detection which detects the error by dividing the data into segments of equal
size and then use 1's complement to find the sum of the segments and then the sum is transmitted
with the data to the receiver and same process is done by the receiver and at the receiver side, all
zeros in the sum indicates the correctness of the data.

 First of all data is divided into k segments in a checksum error detection scheme and each
segment has m bits.
 For finding out the sum at the sender’s side, all segments are added through 1's complement
arithmetic. And for determining the checksum we complement the sum.
 Along with data segments, the checksum segments are also transferred.
 All the segments that are received on the receiver's side are added through 1S complement
arithmetic to determine the sum. Then complement the sum.
 The received data is accepted only on the condition that the result is found to be 0. And if the
result is not 0 then it will be discarded.
Disadvantages: In checksum error is not detected, if one sub-unit of the data has one or
more corrupted bits and corresponding bits of the opposite value are also corrupted in
another sub-unit. Error is not detected in this situation because in this case the sum of
columns is not affected by corrupted bits.

Cyclic Redundancy Check (CRC):


 Unlike the checksum scheme, which is based on addition, CRC is based on binary
division.
 In CRC, a sequence of redundant bits, called cyclic redundancy check bits, are appended
to the end of the data unit so that the resulting data unit becomes exactly divisible by a
second, predetermined binary number.
 At the destination, the incoming data unit is divided by the same number. If at this step
there is no remainder, the data unit is assumed to be correct and is therefore accepted.
 A remainder indicates that the data unit has been damaged in transit and therefore must
be rejected.
CRC Working
We have given dataword of length n and divisor of length k.
Step 1: Append (k-1) zero’s to the original message
Step 2: Perform modulo 2 division
Step 3: Remainder of division = CRC
Step 4: Code word = Data with append k-1 zero’s + CRC
Note:
 CRC must be k-1 bits
 Length of Code word = n+k-1 bits
Example: Let’s data to be send is 1010000 and divisor in the form of polynomial is x3+1. CRC method
discussed below.

Problem-01:
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?

Problem-02:

A bit stream 10011101 is transmitted using the standard CRC method. The generator polynomial is
x3+1.
Error Correction:

When the data is sent from the sender side to the receiver's side it needs to be detected and corrected. So an
error correction method is used for this purpose. Following are the two ways through which error correction
can be handled:

Backward Error Correction


In this method, When any error is found in the data at the receiver's end. Then the request for resending the
whole data unit is sent by the receiver.

Forward Error Correction


In this method, an error-correcting code is used by the receiver that automatically corrects the errors.

Error Correction Techniques


We can detect the error using a single additional bit but we cannot use this bit for the correction purpose. It is
important to know the exact location of the error if we want to correct that error.
For example, for finding out the single-bit error, the error detection code checks out that the error is actually
in one of the seven bits.
Let d represents the number of data bits and r represents the number of redundant bits. The formula below is
used for finding the r number of redundant bits :

2r>=d+r+1
The above formula is used to find out the value of r.
For example, suppose 4 will be the value of d, then 3 will be the only and smallest value that satisfies this
particular relation.

To determine the position of the bit which is in error, a technique developed by R.W Hamming is
Hamming code which can be applied to any length of the data unit and uses the relationship
between data units and redundant units.
Hamming Code:
Parity bits: The bit which is appended to the original data of binary bits so that the total number of
1s iseven or odd.
Even parity: To check for even parity, if the total number of 1s is even, then the value of the
parity bitis 0. If the total number of 1s occurrences is odd, then the value of the parity bit is 1.
Odd Parity: To check for odd parity, if the total number of 1s is even, then the value of parity bit is
1. If .the total number of 1s is odd, then the value of parity bit is 0.
Algorithm of Hamming code:
o An information of 'd' bits are added to the redundant bits 'r' to form d+r.
o The location of each of the (d+r) digits is assigned a decimal value.
o The 'r' bits are placed in the positions 1,2,. ... 2k-1.
o At the receiving end, the parity bits are recalculated. The decimal value of the parity
bitsdetermines the position of an error.
Relationship b/w Error position & binary number:

Let's understand the concept of Hamming code through an example:


Suppose the original data is 1010 which is to be
sent.Total number of data bits 'd' = 4
Number of redundant bits r : 2r >= d+r+1
2r>= 4+r+1
Therefore, the value of r is 3 that satisfies the above
relation.Total number of bits = d+r = 4+3 = 7;
Determining the position of the redundant bits:
The number of redundant bits is 3. The three bits are represented by r1, r2, r4. The position of the
redundant bits is calculated with corresponds to the raised power of 2. Therefore, their
corresponding positions are 1, 21, 22.
1. The position of r1 = 1
2. The position of r2 = 2
3. The position of r4 = 4
Representation of Data on the addition of parity bits:

Determining the Parity bits:


Determining the r1 bit:
The r1 bit is calculated by performing a parity check on the bit positions whose binary
representation includes 1 in the first position.
We observe from the above figure that the bit positions that include 1 in the first position are 1, 3,
5, 7. Now, we perform the even-parity check at these bit positions. The total number of 1 at these bit
positionscorresponding to r1 is even, therefore, the value of the r1 bit is 0.
Determining r2 bit:
The r2 bit is calculated by performing a parity check on the bit positions whose binary
representation includes 1 in the second position.

We observe from the above figure that the bit positions that includes 1 in the second position are 2,
3, 6, 7. Now, we perform the even-parity check at these bit positions. The total number of 1 at
these bit positions corresponding to r2 is odd, therefore, the value of the r2 bit is 1.
Determining r4 bit:
The r4 bit is calculated by performing a parity check on the bit positions whose binary
representation includes 1 in the third position.

We observe from the above figure that the bit positions that includes 1 in the third position are 4, 5,
6,
7. Now, we perform the even-parity check at these bit positions. The total number of 1 at these
bitpositions corresponding to r4 is even, therefore, the value of the r4 bit is 0.
Data transferred is given below:
ELEMENTARY DATA LINK PROTOCOLS

We divide the protocols into those that can be used for noiseless (error-free) channels and those that can
be used for noisy (error-creating) channels. The protocols in the first category cannot be used in real life,
but they serve as a basis for understanding the protocols of noisy channels.

For the noiseless channel, the following two protocols are used:
 Simplest Protocol
 Stop and Wait Protocol

The sliding window protocols are used for noisy channels. The sliding window protocol incomputer
networks is further divided into three parts, as follows:
 Stop and Wait for ARQ
 Go-back ARQ
 Selective Repeat ARQ
NOISELESS CHANNELS:
Simplest Protocols:

In the simplest protocol, no flow or no error control. It is a unidirectional protocol in which


data frames travels in only one direction i.e. from sender to receiver. The following is the
flow diagramof the simplest protocol, with no flow and error control.
Design
There is no need for flow control in this scheme. The data link layer at the sender site gets data from its
network layer, makes a frame out of the data, and sends it. The data link layer at the receiver site receives
a frame from its physical layer, extracts data from the frame, and delivers the data to its network layer.
The data link layers of the sender and receiver provide transmission services for their network layers.
Example:
Below Figure shows an example of communication using this protocol. It is very simple. The sender
sends a sequence of frames without even thinking about the receiver. To send three frames, three events
occur at the sender site and three events at the receiver site. Note that the data frames are shown by tilted
boxes; the height of the box defines the transmission time difference between the first bit and the last bit
in the frame.

Stop-and-Wait Protocol:
If data frames arrive at the receiver site faster than they can be processed, the frames must be stored until
their use. Normally, the receiver does not have enough storage space, especially if it is receiving data
from many sources. This may result in either the discarding of frames or denial of service. To prevent the
receiver from becoming overwhelmed with frames, we somehow need to tell the sender to slow down.
There must be feedback from the receiver to the sender.
The protocol we discuss now is called the Stop-and-Wait Protocol because the sender sends one frame,
stops until it receives confirmation from the receiver (okay to go ahead), and then sends the next frame.
We still have unidirectional communication for data frames, but auxiliary ACK frames (simple tokens of
acknowledgment) travel from the other direction. We add flow control to our previous protocol.
Design
We can see the traffic on the forward channel (from sender to receiver) and the reverse channel. At any
time, there is either one data frame on the forward channel or one ACK frame on the reverse channel. We
therefore need a half-duplex link.
Example:
Below Figure shows an example of communication using this protocol. It is still very simple. The sender
sends one frame and waits for feedback from the receiver. When the ACK arrives, the sender sends the
next frame. Note that sending two frames in the protocol involves the sender in four events and the
receiver in two events.

Disadvantages of Stop and Wait Protocol


1. If the receiver does not respond when there is an error then sender doesn‟t know
whichframe has to be resend.
2. In Stop and Wait protocol the sender doesnot send next frame until it receives
ACK fromreceiver. If the ACK has lost then sender does not know when to send
the frame.
NOISY CHANNELS:
Sliding Window Protocols: this protocol in computer networks is used for noisy channels. In this
mechanism, a frame is sent with a sequence number. At the destination end, the sequence number is used
to find the missing frames. Using these protocols, we can send multiple frames at a time. The sliding
window protocols incomputer networks is further divided into three categories as follows:

1 Stop-and-Wait Automatic Repeat Request


2 Go-Back-N Automatic Repeat Request
3 Selective Repeat Automatic Repeat Request

Stop-and-Wait Automatic Repeat Request:(ARQ)


This Protocol uses Acknowledgements and Sequence Numbers to implement Flow and ErrorControl
mechanisms. The corrupted and lost frames need to be resent in this protocol. In this protocol, the sender
simply discards a corrupted ACK frame or ignores an out-of-orderone.
Sequence Numbers
Sequence Number is the number that is given to the data frame.
A field is added to the data frame to hold the sequence number of that frame.

The sequence numbers are based on modulo-2 arithmetic.


If the seqNo of the frame is the one that is expected (Rn), the frame is accepted, the data are delivered
to the network layer, and the value of Rn is incremented

Range: Consider the field is m bits long, the range of sequence numbers are from 0 to 2m-1,and then
the same number are repeated.

Acknowledgment Numbers
The acknowledgment numbers always announce the sequence number of the next frame
expected by the receiver.

Example:
1. If frame 0 has arrived safe and sound, the receiver sends an ACK frame with
acknowledgment 1 (meaning frame 1 is expected next).
2. If frame 1 has arrived safe and sound, the receiver sends an ACK frame with
acknowledgment 0 (meaning frame 0 is expected).

Design

The sending device keeps a copy of the last frame transmitted until it
receives anacknowledgment for that frame.
The design contains:
 seqNo: Sequence Number
 ackNo: Acknowledgement Number
 Sn: Sender Control variable- that holds the sequence number for the next
frame to besent (0 or 1).
 Rn: Receiver Control Variable- that holds the number of the next frame expected.
When a frame is sent, the value of Sn is incremented (modulo-2), which means if it
is 0, itbecomes 1 and vice versa.
When a frame is received, the value of Rn is incremented (modulo-2), which means
if it is0, it becomes 1 and vice versa.
Sn variable points to the slot that matches the sequence number of the frame that has been
sent, but not acknowledged.
Sequence numbers are modulo-2, the possible numbers are 0,1,0,1,0,1,……and so on.
Rn points to the slot that matches the sequence number of the expected frame.
Three events can happen at the sender site; one event can happen at the receiver site.

Example
Frame 0 is sent and acknowledged.
Frame 1 is lost and resent after the time-out.
The resent frame 1 is acknowledged and the timer stops.
Frame 0 is sent and acknowledged, but the acknowledgment is lost.
The sender has no idea if the frame or the acknowledgment is lost, so after the time-
out, itresends frame 0, which is acknowledged.
Go-Back-N Automatic Repeat Request:

Go-Back-N ARQ protocol is also known as Go-Back-N Automatic Repeat Request. It is a data link layer
protocol that uses a sliding window method. In this, if any frame is corrupted or lost, all subsequent
frames have to be sent again.

The size of the sender window is N in this protocol. For example, Go-Back-7, the size of the sender
window, will be 7. The receiver window size is always 1.

If the receiver receives a corrupted frame, it cancels it. The receiver does not accept a corrupted frame.
When the timer expires, the sender sends the correct frame again. The design of the Go-Back-N ARQ
protocol is shown below.

In this protocol
Sender can send several frames before receiving acknowledgments.
Sender keep a copy of these frames until the acknowledgments arrive.

Design of Go-Back-N ARQ


The idea is similar to Stop-and-Wait ARQ, multiple frames can be in transit in the forward
direction, and multiple acknowledgments in the reverse direction.

The difference is that the send window allows us to have as many frames in
transition as there are slots in the send window.

1. Sequence Numbers
2. Sliding Window
3. Timers
4. Acknowledgement
5. Retransmission (Resending a Frame)

Sequence Numbers
It is a number given to each frame included in the header.
The header of the frame allows m bits for the sequence number, the sequence
numbersrange from 0 to 2m-1.

The sequence numbers are repeated after the number 2m-1 (i.e) the sequence
numbers aremodulo-2m

Example:
If m=4 , the sequence numbers are 0,1,2,3,4,5………14,15,0,1,2,3,4,5,6,…………………..

Sliding Window
Sliding Window is an abstract concept that defines the sender and receiver needs to
deal withonly part of the possible sequence numbers.

There are 2 types of windows are used:


i. Send Window
ii. Receive Window

The range that is the concern of sender is called the send sliding window or Send
Window The range that is the concern of receiver is called receive sliding window or
receive window.
Send Window
The send window is an imaginary box covering the sequence numbers of the data
frameswhich can be in transit.
In each window position, some of these sequence numbers define the frames that
havebeen sent; others define those that can be sent.
The maximum size of the send window is
2m – 1.Example: Let us take m=4. Size of
window=15. Consider the below figure:
The window at any time divides the possible sequence numbers into four regions.

1. The first region (the left side of the window) defines the sequence numbers
belonging to frames that are already acknowledged. The sender don‟t need to keep
copies of the frames.
2. The second region defines the range of sequence numbers belonging to the frames
that are sent and have an unknown status. The sender needs to wait to find out if
these frames have been received or were lost. These frames are called outstanding
frames.

3. The third range defines the range of sequence numbers for frames that can be sent.
The corresponding data packets have not yet been received from the network layer.
4. The fourth region defines sequence numbers that cannot be used until the window slides.

The window uses three variables define its size and location at any time.
i. Sf defines the sequence number of the first (oldest) outstanding frame.
ii. Sn holds the sequence number that will be assigned to the next frame to be sent.

iii. Ssize defines the size of the window, which is fixed in our protocol.

The acknowledgments in this protocol are cumulative, meaning that more than one
frame canbe acknowledged by an ACK frame.

In the above figure frames 0, 1, and 2 are acknowledged, so the window has slid to
the rightthree slots.

Receive Window
The receive window makes sure that the correct data frames are received and
that thecorrect acknowledgments are sent.
The size of the receive window is always 1.
The receiver is always looking for the arrival of a specific frame.
Any frame arriving out of order is discarded and needs to be resent.
There is only one variable required, that is Rn

Rn: defines next frame expected, belongs to Receive Window.

The sequence numbers to the left of the window belong to the frames already
receivedand acknowledged.
The sequence numbers to the right of this window define the frames that
cannot bereceived.
Any received frame with a sequence number in these two regions is discarded.
Only a frame with a sequence number matching the value of Rn is
accepted andacknowledged. (i.e. Sn=Rn)
Timers:
The timer for the first outstanding frame always expires first.We send all outstanding frameswhen this

timer expires

Acknowledgment
The receiver sends a positive acknowledgment if a frame has arrived safe and sound
and in order.
If a frame is damaged or frame is received out of order, the receiver is silent and
will discard all subsequent frames until it receives the one it is expecting.
The silence of the receiver causes the timer of the unacknowledged frame at the
sender site to expire. This causes the sender to go back and resend all frames,
beginning with the one with the expired timer.
The receiver does not have to acknowledge each frame received. It can send one
cumulative acknowledgment for several frames.
Retransmission (Resending a Frame)
When the timer expires, the sender resends all outstanding frames
Example:
Suppose the sender has already sent frame 6, but the timer for frame 3 expires.
This means that frame 3 has not been acknowledged.
The sender goes back and sends frames 3, 4,5, and 6 again.

That is why the protocol is called Go-Back-N ARQ.

Example
The below shows what happens when a frame is lost.
Frames 0, 1, 2, and 3 are sent.
Frame 0 is acknowledged but Frame 1 is lost.
The receiver receives frames 2 and 3, but they are discarded because they are
received outof order (frame 1 is expected)

The sender receives no acknowledgment about frames 1, 2, or 3.


Its timer finally expires. The sender sends all outstanding frames (1, 2, and 3)
because itdoes not know whether the frame is lost or corrupted.
Note that the resending of frames l, 2, and 3 is the response to one single event.
When the sender is responding to this event, it cannot accept the triggering of
otherevents.
This means that when ACK 2 arrives, the sender is still busy with sending frame 3.
The physical layer must wait until this event is completed and the data link
layer goesback to its sleeping state.
Vertical line in the figure is to indicate the delay.

Note that before the second timer expires, all outstanding frames have been sent and the
timeris stopped.
Disadvantage with Go-Back-N ARQ
Go-Back-N ARQ protocol is very inefficient for a noisy link.
Go-Back-N ARQ simplifies the process at the receiver site.
The receiver keeps track of only one variable, and there is no need to buffer out-
of-orderframes and they are simply discarded.
In a noisy link a frame has a higher probability of damage; so it leads to the
resending ofmultiple frames.
This resending uses more bandwidth and slows down the transmission. This is a
majordisadvantage
Solution: When there is just one frame is damaged, then only the damaged frame is resent, instead of
resending from Nth frame. This will be achieved by using Selective Repeat ARQ Protocol.
Selective Repeat Automatic Repeat Request:
It is more efficient for Noisy links but processing at the receiver is more complex.

Window size 2m-1 means the size of the sender and receiver window is at most one half of 2m(i.e 2m/2).

Windows
It uses two windows:
1. Send Window
2. Receive Window
The size of the send window and receive window is same as 2m-1.
Example: If m = 4, the sequence numbers ranges from 0 to 15, but the size of the
window isjust

The Selective Repeat Protocol allows as many frames as the size of the receive
window to arrive out of order and be kept until there is a set of in-order frames to be
delivered to the network layer.
Because the sizes of the send window and receive window are the same, all the
frames in the send frame can arrive out of order and be stored until they can be
delivered.
We need to mention that the receiver never delivers packets out of order to the
network layer.
Those slots inside the receive window that are colored define frames that have arrived outof
order and are waiting for their neighbors to arrive before delivery to the network layer
Example

Receiver Site
At the receiver site we need to distinguish between the acceptance of a frame
and its delivery to the network layer.
At the second arrival, frame 2 arrives and is stored and marked (colored slot),
but itcannot be delivered because frame 1 is missing.
At the next arrival, frame 3 arrives and is marked and stored, but still none of the
frames can be delivered.
Only at the last arrival, when finally a copy of frame 1 arrives and frames 1, 2,
and 3 bedelivered to the network layer.
There are two conditions for the delivery of frames to the network layer:
i. a set of consecutive frames must have arrived.
ii. the set starts from the beginning of the window.
After the first arrival, there was only one frame and it started from the beginning
of thewindow.
After the last arrival, there are three frames and the first one starts from the
beginning ofthe window.
PIGGYBACKING

 The protocols Stop-and-wait ARQ, Go-Back-N ARQ, Selective Repeat ARQ are all unidirectional.
That means data frames flow in only one direction although control information such as ACK and
NAK frames can travel in the other direction.
 In real life, data frames are normally flowing in both directions: from node A to node B and from
node B to node A. This means that the control information also needs to flow in both directions.
This technique called piggybacking.
 Piggybacking is used to improve the efficiency of the bidirectional protocols. When a frame is
carrying data from A to B, it can also carry control information from B to A. Similarly when a
frame is carrying data from B to A, it can also carry control information frames from A to B.

You might also like