CN Unit 2
CN Unit 2
Error is a condition when the receiver’s information does not match the sender’s. Digital signals
suffer from noise during transmission that can introduce errors in the binary bits traveling from
sender to receiver. That means a 0 bit may change to 1 or a 1 bit may change to 0.
Types of Errors
Single-Bit Error
A single-bit error refers to a type of data transmission error that occurs when one bit (i.e., a single
binary digit) of a transmitted data unit is altered during transmission, resulting in an incorrect or
corrupted data unit.
Multiple-Bit Error
A multiple-bit error is an error type that arises when more than one bit in a data transmission is
affected. Although multiple-bit errors are relatively rare when compared to single-bit errors, they can
still occur, particularly in high-noise or high-interference digital environments.
Burst Error
When several consecutive bits are flipped mistakenly in digital transmission, it creates a burst error.
This error causes a sequence of consecutive incorrect values.
To detect errors, a common technique is to introduce redundancy bits that provide additional
information. Various techniques for error detection include:
Checksum
Simple-bit parity is a simple error detection method that involves adding an extra bit to a data
transmission. It works as:
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.
Single Parity check is not able to detect even no. of bit error.
For example, the Data to be transmitted is 101010. Codeword transmitted to the receiver is
1010101 (we have used even parity).
Two-Dimensional Parity Check can detect and correct all single bit error.
Two-Dimensional Parity Check can detect two or three bit error that occur any where in the
matrix.
Two-Dimensional Parity Check can not correct two or three bit error. It can only detect two
or three bit error.
If we have a error in the parity bit then this scheme will not work.
Checksum
Checksum error detection is a method used to identify errors in transmitted data. The
process involves dividing the data into equally sized segments and using a 1’s complement to
calculate the sum of these segments. The calculated sum is then sent along with the data to
the receiver. At the receiver’s end, the same process is repeated and if all zeroes are
obtained in the sum, it means that the data is correct.
On the sender’s end, the segments are added using 1’s complement arithmetic to get the
sum. The sum is complemented to get the checksum.
At the receiver’s end, all received segments are added using 1’s complement arithmetic to
get the sum. The sum is complemented.
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
Note:
Example: Let’s data to be send is 1010000 and divisor in the form of polynomial is x3+1. CRC
method discussed below.
Increased Data Reliability: Error detection ensures that the data transmitted over the
network is reliable, accurate, and free from errors. This ensures that the recipient receives
the same data that was transmitted by the sender.
Improved Network Performance: Error detection mechanisms can help to identify and
isolate network issues that are causing errors. This can help to improve the overall
performance of the network and reduce downtime.
Enhanced Data Security: Error detection can also help to ensure that the data transmitted
over the network is secure and has not been tampered with.
False Positives: Error detection mechanisms can sometimes generate false positives, which
can result in unnecessary retransmission of data. This can further increase the overhead on
the network.
Limited Error Correction: Error detection can only identify errors but cannot correct them.
This means that the recipient must rely on the sender to retransmit the data, which can lead
to further delays and increased network overhead.
Hamming Distance
Hamming distance is a metric for comparing two binary data strings. While comparing two
binary strings of equal length, Hamming distance is the number of bit positions in which the
two bits are different.
In order to calculate the Hamming distance between two strings, and , we perform their XOR
operation, (a⊕ b), and then count the total number of 1s in the resultant string.
Example
Suppose there are two strings 1101 1001 and 1001 1101.
11011001 ⊕ 10011101 = 01000100. Since, this contains two 1s, the Hamming distance,
d(11011001, 10011101) = 2.
Example
Suppose there are four strings 010, 011, 101 and 111.
While transmitting data from sender to receiver, the flow of data is required to be controlled.
Suppose there is a situation where the sender is sending the data at a rate higher than the
rate of the receiver to process and receive the data. Flow Control protocol ensures that the
data does not get lost.
The flow control protocols ensure that the sender sends the data only at a rate that the
receiver can receive and process it.
Noiseless channel is an idealistic channel in which no data frames are lost, corrupted, or
duplicated.
After sending the data, the sender will stop and wait until he receives an acknowledgment
from the receiver.
Flow control service is provided by the data link layer of the OSI suite.
Sender Side
Rule 1: Sender will send one packet at a time
Rule 2: Sender will send the next packet to the receiver only when
it receives the acknowledgment of the previous packet from the
receiver. So, in the stop-and-wait protocol, the sender-side process
is very simple.
Note: The sender sends one packet at a time and does not send the
next packet until it receives an acknowledgment of the previous
packet from the receiver.
Receiver Side
Rule 1: The receiver receives the data packet and then consumes
the data packet. Rule 2: The receiver sends acknowledgment when
the data packet is consumed. So, in this protocol, the receiver-side
process is also very simple.
The sender will not send the second packet to the receiver until acknowledgment of the first
packet is received.
The receiver will send the acknowledgment for the packet that the receiver has received.
When the sender receives the acknowledgment, it sends the next packet to the receiver.
This process of sending data and receiving acknowledgment continues until all the packets
are not sent.
But this protocol has some disadvantages, too; for example, if the sender wants to send
10,000 data packets, and the sender can not send all 10,000 packets at a time in this
protocol, one packet is allowed to be sent at a time.
Refer to the below image to see the working of data transmission in the stop-and-wait
protocol
If we increase the data packet size, the efficiency is going to increase. Hence, it is suitable for
transmitting big data packets.
Stop & wait protocol is accurate as the sender sends the next frame to the receiver only
when the acknowledgment of the previous packet is received. So there is less chance of the
frame being lost.
Kk
Suppose the sender sends the data packet, but the data packet is lost due to some reason. Since the
receiver has not received the packet for a long time, the sender does not receive any
acknowledgment from the receiver, so it will not send the next packet.
For an acknowledgment, the sender has to wait for an infinite amount of time.
The receiver will also have to wait for an infinite amount of time to receive the data.
Refer to the below image to see data loss in the stop-and-wait protocol
l
Suppose the sender sends the packet, and the receiver will send an acknowledgment. But the
acknowledgment sent by the receiver will be lost in the network, therefore sender will not send the
next packet as the acknowledgment is not received In this case, one problem occurs in data
transmission:
The sender has to wait for an infinite amount of time due to acknowledgment loss in the
network.
Refer to the below image to see acknowledgment loss in the stop-and-wait protocol
Suppose the sender sends the data packet, and the receiver will also send the acknowledgment, but
the acknowledgment is received by the sender after the timeout period. So sender will not consider
this acknowledgement as there may be a situation that the sender will retransmit the packet after
time out.
Refer to the below image to see delayed data and acknowledgment in the stop-and-wait protocol
l
Go Back N ARQ is a sliding window protocol which is used for flow control purposes. Multiple
frames present in a single window are sent together from sender to receiver.
Pipelining is allowed in the Go Back N ARQ protocol. Pipelining means sending a frame before
receiving the acknowledgment for the previously sent frame.
The sender window is a fixed-sized window that defines the number of frames that are transmitted
from sender to receiver at once. The integer ‘N’ in the Go Back ‘N’ is the frame size.
is 4.
The Receiver window in the Go Back N ARQ protocol is always of size 1. This means that the
receiver takes at most 1 frame at a single time.
Given below are the steps to clearly explain how the Go Back N ARQ algorithm works.
Data packets are divided into multiple frames. Each frame contains information about the
destination address, the error control mechanism it follows, etc. These multiple frames are
numbered so that they can be distinguished from each other.
2. The integer ‘N’ in Go Back ‘N’ ARQ tells us the size of the window i.e. the number of frames that
are sent at once from sender to receiver. Suppose the window size ‘N’ is equal to 4. Then, 4 frames
(frame 0, frame 1, frame 2, and frame 3) will be sent first from sender to receiver.
3. The receiver sends the acknowledgment of frame 0. Then the sliding window moves by one
and frame 4 is sent.
4. The receiver sends the acknowledgment of frame 1. Then the sliding window moves by one
and frame 3 is sent.
5. The sender waits for the acknowledgment for a fixed amount of time. If the sender does not get
the acknowledgment for a frame in time, it considers the frame to be corrupted. Then the sliding
window moves to the start of the corrupted frame and all the frames in the window are
retransmitted.
For example, if the sender does not receive the acknowledgment for frame 2, it retransmits all the
frames in the windows i.e. frames [2, 3, 4, 5].
For example, if the sender does not receive the acknowledgment for frame 2, it retransmits all the
frames in the windows i.e. frames [2, 3, 4, 5].
5. The sender waits for the acknowledgment for a fixed amount of time. If the sender does not get
the acknowledgment for a frame in time, it considers the frame to be corrupted. Then the sliding
window moves to the start of the corrupted frame and all the frames in the window are
retransmitted.
Characteristics of Go-Back-N ARQ
3. When the acknowledgment for one frame is not received by the sender or the frames
received by the receiver are out of order, then the whole window starting from the
corrupted frame is retransmitted.
Go-Back-N ARQ follows the principle of pipelining i.e. a frame can be sent by the sender before
receiving the acknowledgment of the previously sent frame.
1. It can send multiple frames at once. 2. Pipelining is present in the Go-Back-N ARQ i.e. a frame can
be sent by the sender before receiving the acknowledgment of the previously sent frame. This results
in a shorter waiting time for the frame. 3. It handles corrupted as well as out-of-order frames which
result in minimal frame loss.
1. If acknowledgment for a frame is not received, the whole window of frames is retransmitted
instead of just the corrupted frame. This makes the Go Back N ARQ protocol inefficient.
2. Retransmission of all the frames on detecting a corrupted frame increases channel congestion and
also increases the bandwidth requirement.
3. It is more time-consuming because while retransmitting the frames on detecting a corrupted
frame, the error-free frames are also transmitted.
Wait protocol.
Efficiency
formula for the
Efficiency Efficiency formula
Go-Back-N
formula for the for the Selective
protocol is
Stop and Wait Repeat protocol is
N/(1+2*a),
protocol is N/(1+2*a), where
where a is the
1/(1+2*a), a is the ratio of
proportion of
where a is the propagation delay
propagation
ratio of to transmission
delay to
propagation delay and N is the
transmission
delay to number of
delay and N is
transmission packets
the number of
delay. transmitted.
packets
transmitted.
This protocol(SRP) is mostly identical to GBN protocol, except that buffers are used and the
receiver, and the sender, each maintains a window of size. SRP works better when the link is very
unreliable. Because in this case, retransmission tends to happen more frequently, selectively
retransmitting frames is more efficient than retransmitting all of them. SRP also requires full-
duplex link. backward acknowledgements are also in progress.
Window size should be less than or equal to half the sequence number in SR protocol. This
is to avoid packets being recognized incorrectly. If the size of the window is greater than
half the sequence number space, then if an ACK is lost, the sender may send new packets
that the receiver believes are retransmissions.
Sender can transmit new packets as long as their number is with W of all unACKed packets.
Sender retransmit un-ACKed packets after a timeout – Or upon a NAK if NAK is employed.
Receiver ACKs all correct packets.
Receiver stores correct packets until they can be delivered in order to the higher layer.
In Selective Repeat ARQ, the size of the sender and receiver window must be at most one-
half of 2^m.