unit-2

Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

Unit-2

Design issues with data link layer are :

1. Services provided to the network layer –


The data link layer act as a service interface to the network layer. The principal service is
transferring data from network layer on sending machine to the network layer on destination
machine. This transfer also takes place via DLL (Data link-layer).
It provides three types of services:
1. Unacknowlwdged and connectionless services.
2. Acknowledged and connectionless services.
3. Acknowledged and connection-oriented services
Unacknowledged and connectionless services.
• Here the sender machine sends the independent frames without any
acknowledgement from the sender.
• There is no logical connection established.
Acknowledged and connectionless services.
• There is no logical connection between sender and receiver established.
• Each frame is acknowledged by the receiver.
• If the frame didn’t reach the receiver in a specific time interval it has to be sent
again.
• It is very useful in wireless systems.
Acknowledged and connection-oriented services
• A logical connection is established between sender and receiver before data is
trimester.
• Each frame is numbered so the receiver can ensure all frames have arrived and
exactly once.

2. Frame
Data-link layer takes the packets from the Network Layer and encapsulates them into frames.
If the frame size becomes too large, then the packet may be divided into small sized frames.
Smaller sized frames makes flow control and error control more efficient.
Then, it sends each frame bit-by-bit on the hardware. At receiver's end, data link layer picks up
signals from hardware and assembles them into frames.

Parts of a Frame

A frame has the following parts −

• Frame Header − It contains the source and the destination addresses of the frame.
• Payload field − It contains the message to be delivered.
• Trailer − It contains the error detection and error correction bits.
• Flag − It marks the beginning and end of the frame.

Types of Framing

Framing can be of two types, fixed sized framing and variable sized framing.
Fixed-sized Framing
Here the size of the frame is fixed and so the frame length acts as delimiter of the frame.
Consequently, it does not require additional boundary bits to identify the start and end of the
frame.

Example − ATM cells.

Variable – Sized Framing


Here, the size of each frame to be transmitted may be different. So additional mechanisms are
kept to mark the end of one frame and the beginning of the next frame.

It is used in local area networks.

Error control

Error control in data link layer is the process of detecting and correcting data frames that have
been corrupted or lost during transmission.

In case of lost or corrupted frames, the receiver does not receive the correct data-frame and
sender is ignorant about the loss. Data link layer follows a technique to detect transit errors and
take necessary actions, which is retransmission of frames whenever error is detected or frame
is lost. The process is called Automatic Repeat Request (ARQ).

Phases in Error Control

The error control mechanism in data link layer involves the following phases −

• Detection of Error − Transmission error, if any, is detected by either the sender or the
receiver.
• Acknowledgment − acknowledgment may be positive or negative.
o Positive ACK − On receiving a correct frame, the receiver sends a positive
acknowledge.
o Negative ACK − On receiving a damaged frame or a duplicate frame, the
receiver sends a negative acknowledgment back to the sender.
• Retransmission − The sender maintains a clock and sets a timeout period. If an
acknowledgment of a data-frame previously transmitted does not arrive before the
timeout, or a negative acknowledgment is received, the sender retransmits the frame.

Error Control Techniques

There are three main techniques for error control −


• Stop and Wait ARQ
This protocol involves the following transitions −
o A timeout counter is maintained by the sender, which is started when a frame is
sent.
o If the sender receives acknowledgment of the sent frame within time, the sender
is confirmed about successful delivery of the frame. It then transmits the next
frame in queue.
o If the sender does not receive the acknowledgment within time, the sender
assumes that either the frame or its acknowledgment is lost in transit. It then
retransmits the frame.
o If the sender receives a negative acknowledgment, the sender retransmits the
frame.
• Go-Back-N ARQ
The working principle of this protocol is −
o The sender has buffers called sending window.
o The sender sends multiple frames based upon the sending-window size, without
receiving the acknowledgment of the previous ones.
o The receiver receives frames one by one. It keeps track of incoming frame’s
sequence number and sends the corresponding acknowledgment frames.
o After the sender has sent all the frames in window, it checks up to what sequence
number it has received positive acknowledgment.
o If the sender has received positive acknowledgment for all the frames, it sends
next set of frames.
o If sender receives NACK or has not receive any ACK for a particular frame, it
retransmits all the frames after which it does not receive any positive ACK.
• Selective Repeat ARQ
o Both the sender and the receiver have buffers called sending window and
receiving window respectively.
o The sender sends multiple frames based upon the sending-window size, without
receiving the acknowledgment of the previous ones.
o The receiver also receives multiple frames within the receiving window size.
o The receiver keeps track of incoming frame’s sequence numbers, buffers the
frames in memory.
o It sends ACK for all successfully received frames and sends NACK for only
frames which are missing or damaged.
o The sender in this case, sends only packet for which NACK is received.

Flow control
Flow control is a technique that allows two stations working at different speeds to communicate
with each other. It is a set of measures taken to regulate the amount of data that a sender sends
so that a fast sender does not overwhelm a slow receiver. In data link layer, flow control
restricts the number of frames the sender can send before it waits for an acknowledgment from
the receiver.

Approaches of Flow Control

Flow control can be broadly classified into two categories −

• Feedback based Flow Control In these protocols, the sender sends frames after it has
received acknowledgments from the user. This is used in the data link layer.
• Rate based Flow Control These protocols have built in mechanisms to restrict the rate
of transmission of data without requiring acknowledgment from the receiver. This is
used in the network layer and the transport layer.

Flow Control Techniques in Data Link Layer

Data link layer uses feedback-based flow control mechanisms. There are two main techniques

Stop and Wait

This protocol involves the following transitions −

• The sender sends a frame and waits for acknowledgment.


• Once the receiver receives the frame, it sends an acknowledgment frame back to the
sender.
• On receiving the acknowledgment frame, the sender understands that the receiver is
ready to accept the next frame. So it sender the next frame in queue.

Sliding Window

This protocol improves the efficiency of stop and wait protocol by allowing multiple frames to
be transmitted before receiving an acknowledgment.

The working principle of this protocol can be described as follows −

• Both the sender and the receiver has finite sized buffers called windows. The sender
and the receiver agrees upon the number of frames to be sent based upon the buffer
size.
• The sender sends multiple frames in a sequence, without waiting for acknowledgment.
When its sending window is filled, it waits for acknowledgment. On receiving
acknowledgment, it advances the window and transmits the next frames, according to
the number of acknowledgments received.

automatic Repeat ReQuest (ARQ) is a group of error – control protocols for transmission of
data over noisy or unreliable communication network. These protocols reside in the Data Link
Layer and in the Transport Layer of the OSI (Open Systems Interconnection) reference model.
They are named so because they provide for automatic retransmission of frames that are
corrupted or lost during transmission. ARQ is also called Positive Acknowledgement with
Retransmission (PAR).

ARQs are used to provide reliable transmissions over unreliable upper layer services. They are
often used in Global System for Mobile (GSM) communication.

Working Principle

In these protocols, the receiver sends an acknowledgement message back to the sender if it
receives a frame correctly. If the sender does not receive the acknowledgement of a transmitted
frame before a specified period of time, i.e. a timeout occurs, the sender understands that the
frame has been corrupted or lost during transit. So, the sender retransmits the frame. This
process is repeated until the correct frame is transmitted.

Types of ARQ Protocols

There are three ARQ protocols in the data link layer.

• Stop – and – Wait ARQ − Stop – and – wait ARQ provides unidirectional data
transmission with flow control and error control mechanisms, appropriate for noisy
channels. The sender keeps a copy of the sent frame. It then waits for a finite time to
receive a positive acknowledgement from receiver. If the timer expires, the frame is
retransmitted. If a positive acknowledgement is received then the next frame is sent.
• Go – Back – N ARQ − Go – Back – N ARQ provides for sending multiple frames
before receiving the acknowledgement for the first frame. It uses the concept of sliding
window, and so is also called sliding window protocol. The frames are sequentially
numbered and a finite number of frames are sent. If the acknowledgement of a frame is
not received within the time period, all frames starting from that frame are
retransmitted.
• Selective Repeat ARQ − This protocol also provides for sending multiple frames
before receiving the acknowledgement for the first frame. However, here only the
erroneous or lost frames are retransmitted, while the good frames are received and
buffered.

Errors
When bits are transmitted over the computer network, they are subject to get corrupted due to
interference and network problems. The corrupted bits leads to spurious data being received by
the destination and are called errors.

Types of Errors

Errors can be of three types, namely single bit errors, multiple bit errors, and burst errors.

• Single bit error − In the received frame, only one bit has been corrupted, i.e. either
changed from 0 to 1 or from 1 to 0.

• Multiple bits error − In the received frame, more than one bits are corrupted.

• Burst error − In the received frame, more than one consecutive bits are corrupted.

Error Detecting Techniques:

The most popular Error Detecting Techniques are:

o Single parity check


o Checksum
o Cyclic redundancy check

Single Parity Check

o Single Parity checking is the simple mechanism and inexpensive to detect the errors.
o In this technique, a redundant bit is also known as a parity bit which is appended at the
end of the data unit so that the number of 1s becomes even. Therefore, the total number
of transmitted bits would be 9 bits.
o If the number of 1s bits is odd, then parity bit 1 is appended and if the number of 1s bits
is even, then parity bit 0 is appended at the end of the data unit.
o At the receiving end, the parity bit is calculated from the received data bits and
compared with the received parity bit.
o This technique generates the total number of 1s even, so it is known as even-parity
checking.

Drawbacks Of Single Parity Checking


o It can only detect single-bit errors which are very rare.
o If two bits are interchanged, then it cannot detect the errors.
Checksum
A Checksum is an error detection technique based on the concept of redundancy.

It is divided into two parts:

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.

Suppose L is the total sum of the data segments, then the checksum would be ?L

1. The Sender follows the given steps:


2. The block unit is divided into k sections, and each of n bits.
3. All the k sections are added together by using one's complement to get the sum.
4. The sum is complemented and it becomes the checksum field.
5. The original data and checksum field are sent across the network.
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.

1. The Receiver follows the given steps:


2. The block unit is divided into k sections and each of n bits.
3. All the k sections are added together by using one's complement algorithm to get the
sum.
4. The sum is complemented.
5. If the result of the sum is zero, then the data is accepted otherwise the data is discard
ed.

Cyclic Redundancy Check (CRC)

CRC is a redundancy error technique used to determine the error.

Following are the steps used in CRC for error detection:

o In CRC technique, a string of n 0s is appended to the data unit, and this n number is
less than the number of bits in a predetermined number, known as division which is
n+1 bits.
o Secondly, the newly extended data is divided by a divisor using a process is known as
binary division. The remainder generated from this division is known as CRC
remainder.
o Thirdly, the CRC remainder replaces the appended 0s at the end of the original data.
This newly generated unit is sent to the receiver.
o The receiver receives the data followed by the CRC remainder. The receiver will treat
this whole unit as a single unit, and it is divided by the same divisor that was used to
find the CRC remainder.

If the resultant of this division is zero which means that it has no error, and the data is accepted.

If the resultant of this division is not zero which means that the data consists of an error.
Therefore, the data is discarded.
Let's understand this concept through an example:

ADVERTISEMENT
ADVERTISEMENT

Suppose the original data is 11100 and divisor is 1001.

CRC Generator
o A CRC generator uses a modulo-2 division. Firstly, three zeroes are appended at the
end of the data as the length of the divisor is 4 and we know that the length of the string
0s to be appended is always one less than the length of the divisor.
o Now, the string becomes 11100000, and the resultant string is divided by the divisor
1001.
o The remainder generated from the binary division is known as CRC remainder. The
generated value of the CRC remainder is 111.
o CRC remainder replaces the appended string of 0s at the end of the data unit, and the
final string would be 11100111 which is sent across the network.
CRC Checker
o The functionality of the CRC checker is similar to the CRC generator.
o When the string 11100111 is received at the receiving end, then CRC checker performs
the modulo-2 division.
o A string is divided by the same divisor, i.e., 1001.
o In this case, CRC checker generates the remainder of zero. Therefore, the data is
accepted.
Hamming Code
Parity bits: The bit which is appended to the original data of binary bits so that the total number
of 1s is even or odd.

Even parity: To check for even parity, if the total number of 1s is even, then the value of the
parity bit is 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
bits determines 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 includes 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 positions corresponding 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 bit positions corresponding to r4 is even, therefore, the value of the r4 bit is 0.

Data transferred is given below:

Suppose the 4th bit is changed from 0 to 1 at the receiving end, then parity bits are recalculated.

R1 bit

The bit positions of the r1 bit are 1,3,5,7

We observe from the above figure that the binary representation of r1 is 1100. Now, we perform
the even-parity check, the total number of 1s appearing in the r1 bit is an even number.
Therefore, the value of r1 is 0.
R2 bit

The bit positions of r2 bit are 2,3,6,7.

We observe from the above figure that the binary representation of r2 is 1001. Now, we perform
the even-parity check, the total number of 1s appearing in the r2 bit is an even number.
Therefore, the value of r2 is 0.

R4 bit

The bit positions of r4 bit are 4,5,6,7.

We observe from the above figure that the binary representation of r4 is 1011. Now, we perform
the even-parity check, the total number of 1s appearing in the r4 bit is an odd number.
Therefore, the value of r4 is 1.

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy