Data Link Layer: Unit - III
Data Link Layer: Unit - III
Data Link Layer: Unit - III
Unit - III
Framing in Data Link Layer
• synchronized transmission of bits from the source to the destination.
• packs bits into frames.
• 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
• Fixed-sized Framing
• Here the size of the frame is fixed
• the frame length acts as delimiter of the frame
• does not require additional boundary bits to identify the start and
end of the frame.
• Example − ATM cells.
• Variable – Sized Framing
• the size of each frame to be transmitted may be different
• additional mechanisms are kept to mark the end of one frame and
the beginning of the next frame.
Two ways to define frame delimiters in variable sized framing are −
• Length Field − Here, a length field is used that determines the size of
the frame.
• End Delimiter − Here, a pattern is used as a delimiter to determine
the size of frame.
• If the pattern occurs in the message, then two approaches are used to
avoid the situation −
• Byte – Stuffing − A byte is stuffed in the message to differentiate from the
delimiter. This is also called character-oriented framing.
• Bit – Stuffing − A pattern of bits of arbitrary length is stuffed in the message
to differentiate from the delimiter. This is also called bit – oriented framing.
Error Detection and Correction in Data link Layer
• bit streams of data, are transmitted from the source to the destination with a
certain extent of accuracy.
Errors
• Data may 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
• Single bit error
• Multiple bits error
• Burst error
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 Control
• Error control can be done in two ways
• Error detection − Error detection involves checking whether any error has occurred or not.
• Error correction − Error correction involves ascertaining the exact number of bits that has
been corrupted and the location of the corrupted bits.
• For both error detection and error correction, the sender needs to send some additional
bits along with the data bits.
• The receiver performs necessary checks based upon the additional redundant bits.
• If it finds that the data is free from errors, it removes the redundant bits before passing the
message to the upper layers.
Error Detection Techniques
• There are three main techniques for detecting errors in frames: Parity Check,
Checksum and Cyclic Redundancy Check (CRC).
• Parity Check
• The parity check is done by adding an extra bit, called parity bit to the data
While creating a frame, the sender counts the number of 1s in it and adds the
parity bit in the following way
• In case of even parity: If a number of 1s is even then parity bit value is 0. If the
number of 1s is odd then parity bit value is 1.
• In case of odd parity: If a number of 1s is odd then parity bit value is 0. If a
number of 1s is even then parity bit value is 1.
• On receiving a frame, the receiver counts the number of 1s in it.
• In case of even parity check, if the count of 1s is even, the frame is accepted,
otherwise, it is rejected. A similar rule is adopted for odd parity check.
• The parity check is suitable for single bit error detection only.
Checksum
• The Data Link Layer is responsible for transmission of data between two nodes.
Its main functions are-
• Data Link Control
• Multiple Access Control
• Data Link control
• reliable transmission of message over transmission channel by using techniques
like framing, error control and flow control
Multiple Access Control
• If there is a dedicated link between the sender and the receiver then data link
control layer is sufficient
• if there is no dedicated link present then multiple stations can access the
channel simultaneously.
• Hence multiple access protocols are required to decrease collision and avoid
crosstalk.
1. Random Access Protocol
• all stations have same superiority
It has two features
• There is no fixed time for sending data
• There is no fixed sequence of stations sending data
(a) ALOHA –
• It was designed for wireless LAN but is also applicable for shared
medium.
• multiple stations can transmit data at the same time and can hence
lead to collision and data being garbled.
• Pure Aloha
• Slotted Aloha
• Checksum Example-
•
• 10011001111000100010010010000100
• Step-01:
•
• At sender side,
• Now, all the segments are added and the result is obtained as-
• Step-02:
•
• The data along with the checksum value is transmitted to the receiver.
•
• Step-03:
•
• At receiver side,