Data Link Layer
Data Link Layer
Objectives
The data link layer transforms the physical
layer (a raw transmission facility) to a link
responsible for node-to-node (hop-to-hop)
communication.
Specific responsibilities of the data link
layer include framing, addressing, flow
control, error control, and media access
control.
Framing
The data link layer divides the stream of
bits received from the network layer into
manageable data units called frames.
The data link layer adds a header to the
frame to define the addresses of the sender
and receiver of the frame.
Flow control
If the rate at which the data are absorbed by
the receiver is less than the rate at which
data are produced in the sender, the data
link layer imposes a flow control
mechanism to avoid overwhelming the
receiver.
Error detection
The data link layer also adds reliability to
the physical layer by adding mechanisms to
detect and retransmit damaged, duplicate, or
lost frames.
Acess control
When two or more devices are connected to
the same link, data link layer protocols are
necessary to determine which device has
control over the link at any given time.
Error Detection
and Correction
Types of Errors
Detection
Correction
Basic concepts
Networks must be able to transfer data from
one device to another with complete accuracy.
Data can be corrupted during transmission.
For reliable communication, errors must be
detected and corrected.
Types of Errors
Single-bit error
Burst error
Error detection
Error detection means to decide whether the
received data is correct or not without having a
copy of the original message.
Error detection uses the concept of redundancy,
which means adding extra bits for detecting
errors at the destination.
redundancy
The central concept in detecting or correcting errors
is redundancy.
To be able to detect or correct errors, we need to
send some extra bits with our data.
These redundant bits are added by the sender and
removed by the receiver.
Their presence allows the receiver to detect or
correct corrupted bits.
Redundancy
Detection Vs correction
Correction of errors is more difficult than
detection.
In error detection, we are only looking
whether any error has occurred.
In error correction, we need to know exact
no. of bits that are corrupted & their
location in message.
Coding
Redundancy is achieved through various
coding schemes.
The sender adds redundant bits through a
process that creates a relationship between
the redundant bits and the actual data bits.
The receiver checks the relationships
between the two sets of bits to detect or
correct the errors.
Block Coding
Message is divided into blocks, each of k-bits called
datawords.
We add r redundant bits to each block to make
length n = k+r (where n-bit blocks are called
codewords).
We can create combination of 2k datawords & 2n
codewords.
2n - 2k codewords are not used (called invalid).
Error Detection
Following 2 conditions must be met:
Hamming Distance
Checksum
The checksum is used in the Internet by
several protocols although not at the data
link layer.
Like linear codes, the checksum is based on
the concept of redundancy.
Checksum
At the sender
The unit is divided into k sections, each of n
bits.
All sections are added together using ones
complement to get the sum.
The sum is complemented and becomes the
checksum.
The checksum is sent with the data
At the receiver
The unit is divided into k sections, each of n
bits.
All sections are added together using ones
complement to get the sum.
The sum is complemented.
If the result is zero, the data are accepted:
otherwise, they are rejected.
Performance
The checksum detects all errors involving an
odd number of bits.
It detects most errors involving an even number
of bits.
If one or more bits of a segment are damaged
and the corresponding bit or bits of opposite
value in a second segment are also damaged, the
sums of those columns will not change and the
receiver will not detect a problem.
Error Correction
It can be handled in two ways:
1) receiver can say to the sender to
retransmit the entire data unit.
2) The receiver can use an error-correcting
code, which automatically corrects certain
errors.
2r m+r+1
Error Correction
Hamming Code
Hamming Code
Hamming Code
Single-bit error
Error
Detection