Computer Networking Unit -2
Computer Networking Unit -2
Types Of Error
In the Data Link Layer, errors occur when bits are corrupted during transmission
between two devices. The types of errors in the Data Link Layer can be classified
mainly into three categories:
1. Single-bit Error:
Definition: A single-bit error occurs when only one bit in the data unit is altered
from 1 to 0 or from 0 to 1.
Cause: This can be caused by noise or some external disturbance during
transmission.
Example:
Original Data: 11010101
Received Data: 11011101
Here, only the 4th bit from the left has been altered from 0 to 1, resulting in a
single-bit error.
Single-bit errors are usually rare in systems that use modern transmission methods
but can happen due to noise or interference in the communication channel. Error
detection techniques, like parity checks, are often used to detect such errors and
ensure data integrity.
2. Burst Error:
Definition: A burst error occurs when two or more consecutive bits in the data unit
are changed.
Characteristics:
Burst errors are more common than single-bit errors.
The length of the burst error is determined by the number of bits that have been
altered from the first changed bit to the last changed bit.
Example:
Original Data: 1011001101
Received Data: 1011110001
In this case, the 4th, 5th, 6th, and 7th bits have been altered, resulting in a burst
error of length 4.
Other Example->
3.Multiple Bit Errors:
a multiple-bit error affects two or more bits. For example, in an 8-bit sequence, if
the original data is 10101010 and is received as 11100010, multiple bits have been
changed.
Other Example->
OR
Longitudinal Redundancy Check (LRC) is also known as 2-D parity check. In this
method, data which the user want to send is organized into tables of rows and
columns. A block of bit is divided into table or matrix of rows and columns. In order
to detect an error, a redundant bit is added to the whole block and this block is
transmitted to receiver. The receiver uses this redundant row to detect error. After
checking the data for errors, receiver accepts the data and discards the redundant
row of bits.
How LRC Works:
Data Block Formation: The data to be transmitted is divided into rows of equal-
length bits.
Parity Calculation: For each column of the data block (taking one bit from each
row), a parity bit is calculated (usually even or odd parity).
Parity Byte Generation: The calculated parity bits from each column are combined
to form a parity byte or LRC byte.
Transmission: Both the data block and the LRC byte are sent to the receiver.
Error Detection at Receiver: The receiver recalculates the LRC from the received
data block and compares it with the received LRC byte. If they match, no error is
detected. If they differ, an error has occurred during transmission.
Example :
If a block of 32 bits is to be transmitted, it is divided into matrix of four rows and
eight columns which as shown in the following figure :
In this matrix of bits, a parity bit (odd or even) is calculated for each column. It
means 32 bits data plus 8 redundant bits are transmitted to receiver. Whenever
data reaches at the destination, receiver uses LRC to detect error in data.
Advantage :
LRC is used to detect burst errors.
Example : Suppose 32 bit data plus LRC that was being transmitted is hit by a burst
error of length 5 and some bits are corrupted as shown in the following figure :
The LRC received by the destination does not match with newly corrupted LRC. The
destination comes to know that the data is erroneous, so it discards the data.
Disadvantage :
The main problem with LRC is that, it is not able to detect error if two bits in a data
unit are damaged and two bits in exactly the same position in other data unit are
also damaged.
Example : If data 110011 010101 is changed to 010010110100.
In this example 1st and 6th bit in one data unit is changed . Also, the 1st and 6th
bit in second unit is changed.
VRC-
Vertical Redundancy Check is also known as Parity Check. In this method, a
redundant bit also called parity bit is added to each data unit. This method includes
even parity and odd parity. Even parity means the total number of 1s in data is to
be even and odd parity means the total number of 1s in data is to be odd. Example
– If the source wants to transmit data unit 1100111 using even parity to the
destination. The source will have to pass through Even Parity Generator.
Parity generator will count number of 1s in data unit and will add parity bit. In the
above example, number of 1s in data unit is 5, parity generator appends a parity bit
1 to this data unit making the total number of 1s even i.e.. 6 which is clear from
above figure. Data along with parity bit is then transmitted across the network. In
this case, 11001111 will be transmitted. At the destination, This data is passed to
parity checker at the destination. The number of 1s in data is counted by parity
checker. If the number of 1s count out to be odd, e.g. 5 or 7 then destination will
come to know that there is some error in the data. The receiver then rejects such
an erroneous data unit.
Advantages :
VRC can detect all single bit error.
It can also detect burst errors but only in those cases where number of bits changed
is odd, i.e. 1, 3, 5, 7, …….etc.
VRC is simple to implement and can be easily incorporated into different
communication protocols and systems.
It is efficient in terms of computational complexity and memory requirements.
VRC can help improve the reliability of data transmission and reduce the likelihood
of data corruption or loss due to errors.
VRC can be combined with other error detection and correction techniques to
improve the overall error handling capabilities of a system.
Disadvantages :
The major disadvantage of using this method for error detection is that it is not able
to detect burst error if the number of bits changed is even, i.e. 2, 4, 6, 8, …….etc.
Example – If the original data is 1100111. After adding VRC, data unit that will be
transmitted is 11001111. Suppose on the way 2 bits are 01011111. When this data
will reach the destination, parity checker will count number of 1s in data and that
comes out to be even i.e. 6. So, in this case, parity is not changed, it is still even.
Destination will assume that there is no error in data even though data is erroneous.
VRC is not capable of correcting errors, only detecting them. This means that it can
identify errors, but it cannot fix them.
VRC is not suitable for applications that require high levels of error detection and
correction, such as mission-critical systems or safety-critical applications.
VRC is limited in its ability to detect and correct errors in large blocks of data, as the
probability of errors increases with the size of the data block.
VRC requires additional overhead bits to be added to the data stream, which can
increase the bandwidth and storage requirements of the system.
-------------------------------------------------------------------------------------
Error Detection Code – Checksum
Checksum is the error detection method used by upper layer protocols and is
considered to be more reliable than LRC, VRC and CRC. This method makes the use
of Checksum Generator on Sender side and Checksum Checker on Receiver side.
At the Sender side, the data is divided into equal subunits of n bit length by the
checksum generator. This bit is generally of 16-bit length. These subunits are then
added together using one’s complement method. This sum is of n bits. The resultant
bit is then complemented. This complemented sum which is called checksum is
appended to the end of original data unit and is then transmitted to receiver.
Receiver Site :
10101001 subunit 1
00111001 subunit 2
00011101 checksum
11111111 sum
00000000 sum's complement
Disadvantages of Checksum
The main problem is that the error goes undetected if one or more bits of a subunit
is damaged and the corresponding bit or bits of a subunit are damaged and the
corresponding bit or bits of opposite value in second subunit are also damaged. This
is because the sum of those columns remains unchanged.
The binary data is first augmented by adding k-1 zeros in the end of the data
Use modulo-2 binary division to divide binary data by the key and store remainder
of division.
Append the remainder at the end of the data to form the encoded data and send
the same
Receiver Side (Check if there are errors introduced in transmission)
Perform modulo-2 division again and if the remainder is 0, then there are no
errors.
Data word to be sent - 100100
Key - 1101 [ Or generator polynomial x3 + x2 + 1]
Sender Side:
Receiver Side:
Code word received at the receiver side 100100001
Therefore, the remainder is all zeros. Hence, the
data received has no error.
Advantages
Efficient error detection: CRC is highly efficient at detecting errors, including single-
bit errors, burst errors, and some types of multiple-bit errors.
Simplicity: CRC is easy to implement, especially in binary hardware, because it
involves straightforward bitwise operations. It's also easy to analyze
mathematically.
Disadvantages
Limited error correction: CRC is good at detecting errors, but it can't correct them.
If an error is detected, the data, command, or response needs to be retransmitted.
Possibility of undetected errors: In rare situations, errors may remain undetected
even with CRC.
2r ≥ m + r + 1
where m is the number of bits in input data, and r is the number of redundant
bits.
This formula ensures that the code can detect and correct single-bit errors in the
transmitted message.
Example:
Let’s say you want to transmit 4 bits of data: 1011.
---------------------------------------------------------------------
Stop And Wait Protocol
Stop-and-wait ARQ, commonly known as the alternating bit protocol, refers to a
communication technique used to transmit data between two linked devices. It
makes sure that packets are received in the right order, and that data is not lost as
a result of dropped packets.
We must first think the error control mechanism in order to understand the stop
and wait protocol. The error control technique is used to ensure that the received
data is identical to that sent by the sender. The two types of error control
mechanisms are Sliding Window and Stop and Wait ARQ. The sliding window is
further separated into the Go Back N and Selective Repeat categories
Stop and Wait Protocol
In this case, stop and wait means that the sender provides the recipient’s desired
data. The sender pauses after transferring the data and waits for the receiver to
acknowledge his transmission. The stop and wait protocol, which is a flow control
protocol, uses the data link layer’s flow control functionality.
It is a DDL (data-link layer) protocol that is used to send data through channels
with no background noise. It offers unidirectional data transfer, which means that
only one of the two operations, data sending or receiving, can occur concurrently.
The concept behind using this frame is that after sending one frame, the sender
will wait for an acknowledgement before sending another one.
Primitives of Stop and Wait Protocol
Sender’s Side
Rule 1: The sender sends one data packet at a time.
Rule 2: The sender only sends the subsequent packet after getting the preceding
packet’s acknowledgement.
Receiver’s Side
Rule 1: Receive the data packet, then consume it.
Let’s say the sender sends the data, but it gets lost in transit. The receiver is
patiently awaiting the data packet. The receiver does not send an
acknowledgement because it does not receive the data. The sender won’t
send the subsequent packet because it has not received any
acknowledgement. The lost data is the root cause of this issue.
In this instance, there are two problems:
The sender waits an endless length of time for a response.
The receiver waits indefinitely for data.
2. Problems arise as a result of the lost acknowledgement
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.
• Go-Back-N ARQ
• Selective Repeat ARQ
Go-Back-N ARQ
The Go-Back-N (GBN) protocol is a sliding window protocol used in networking for
reliable data transmission. It is part of the Automatic Repeat request (ARQ)
protocols, which ensure that data is correctly received and that any lost or
corrupted packets are retransmitted.
1. Sender Window Size (Ws)- It is N itself. If we say the protocol is GB10, then
Ws = 10. N should be always greater than 1 in order to implement pipelining.
On the sender side for every packet send there is a time out timer which will
expire for packet number 2. Now from the last transmitted packet 5 sender
will go back to the packet number 2 in the current window and transmit all
the packets till packet number 5. That’s why it is called Go Back N. Go back
means sender has to go back N places from the last transmitted packet in the
unacknowledged window and not from the point where the packet is lost.
3.Acknowledgements
There are 2 kinds of acknowledgements namely:
• Cumulative Ack: One acknowledgement is used for many packets. The main
advantage is traffic is less. A disadvantage is less reliability as if one ack is the
loss that would mean that all the packets sent are lost.
• Independent Ack: If every packet is going to get acknowledgement
independently then the reliability is high here but a disadvantage is that
traffic is also high since for every packet we are receiving independent ack.
Advantages of GBN Protocol
Simple to implement and effective for reliable communication.
Better performance than stop-and-wait protocols for error-free or low-error
networks.
Disadvantages of GBN Protocol
Inefficient if errors are frequent, as multiple frames might need to be
retransmitted unnecessarily.
Bandwidth can be wasted due to redundant retransmissions.
1. ALOHA Protocol
ALOHA is one of the earliest random-access protocols developed for wireless
communication.
How It Works:
Pure ALOHA:
Devices transmit whenever they have data to send.
After sending, the device listens for an acknowledgment.
If no acknowledgment is received within a certain timeframe, it assumes a
collision occurred and retransmits after a random delay.
Slotted ALOHA:
Time is divided into discrete slots.
Devices can only transmit at the beginning of these time slots.
Reduces the chance of collision compared to Pure ALOHA.
Throughput:
In a Wi-Fi network, multiple devices like laptops and smartphones use CSMA/CA to
coordinate access to the wireless medium, reducing the likelihood of data packet
collisions.
Advantages:
• Better suited for wireless environments.
• Reduces collisions by avoiding simultaneous transmissions.
Disadvantages:
More complex than CSMA/CD.
Potential for increased latency due to backoff periods.
-------------------------------------------------------------------------------------