CN CDT10
CN CDT10
UNIT-2
DATA LINK LAYER
Classroom Discussion Topic
W4 – L1-CDT10
Topic: Data link layer design issues
2
Functions of Data Link Layer
•Framing: Framing is a function of the data link layer. It provides a
way for a sender to transmit a set of bits that are meaningful to
the receiver. This can be accomplished by attaching special bit
patterns to the beginning and end of the frame.
•Physical addressing: After creating frames, Data link layer adds
physical addresses (MAC address) of sender and/or receiver in the
header of each frame.
•Error control: Data link layer provides the mechanism of error
control in which it detects and retransmits damaged or lost
frames.
•Flow Control: The data rate must be constant on both sides else
the data may get corrupted thus , flow control coordinates that
amount of data that can be sent before receiving
acknowledgement.
•Access control: When a single communication channel
is shared by multiple devices, MAC sub-layer of data link
layer helps to determine which device has control over
the channel at a given time.
Error Control
Sender checksums the frame and transmits checksum together with data.
Receiver re-computes the checksum and compares it with the received
value.
Flow Control
Prevent a fast sender from overwhelming a slower receiver.
•the data link layer takes the packets it gets from the network layer and
encapsulates them into frames for transmission. Each frame contains a frame
header, a payload field for holding the packet, and a frame trailer
9
SERVICES PROVIDED TO THE NETWORK LAYER
The function of the data link layer is to provide services to the network
layer. The principal service is transferring data from the network layer
on the source machine to the network layer on the destination
machine.
The data link layer can be designed to offer various services. The
actual services offered can vary from system to system. Three
reasonable possibilities that are commonly provided are
This class of service is appropriate when the error rate is very low so
that recovery is left to higher layers. It is also appropriate for real-
time traffic, such as voice, in which late data are worse than bad
data. Most LANs use unacknowledged connectionless service in the
data link layer.
1
2
ACKNOWLEDGED CONNECTIONLESS SERVICE
When this service is offered, there are still no logical connections
used, but each frame sent is individually acknowledged.
In this way, the sender knows whether a frame has arrived correctly.
If it has not arrived within a specified time interval, it can be sent
again.
This service is useful over unreliable channels, such as wireless
systems.
Adding Ack in the DLL rather than in the Network Layer is just an
optimization and not a requirement.
If individual frames are acknowledged and transmitted, entire
packets get through much faster.
On reliable channels, such as fiber, the overhead of a heavyweight
data link protocol may be unnecessary, but on wireless channels,
1
with their inherent unreliability, it is well worth the cost. 3
ACKNOWLEDGED CONNECTION-ORIENTED SERVICE
Here, the source and destination machines establish a
connection before any data are transferred. Each frame sent
over the connection is numbered, and the data link layer
guarantees that each frame sent is indeed received.
Furthermore, it guarantees that each frame is received
exactly once and that all frames are received in the right
order.
15
FRAMING
DLL translates the physical layer's raw bit stream
into discrete units (messages) called frames.
16
FRAMING – CHARACTER COUNT
The first framing method uses a field in the header to specify the
number of characters in the frame. When the data link layer at the
destination sees the character count, it knows how many characters
follow and hence where the end of the frame is.
11
The trouble with this algorithm is that the count can be garbled by a
transmission error.
FRAMING – BYTE STUFFING
Use reserved characters to indicate the start and end of a frame.
For instance, use the two-character sequence DLE STX (Data-Link Escape,
Start of TeXt) to signal the beginning of a frame, and the sequence DLE ETX
(End of TeXt) to flag the frame's end.
Starting and ending character stuffing, gets around the problem of
resynchronization after an error by having each frame start with the ASCII
character sequence DLE STX and end with the sequence DLE ETX.
Problem: What happens if the two-character sequence DLE ETX
happens to appear in the frame itself?
Solution: Use character stuffing; within the frame, replace every
occurrence of DLE with the two-character sequence DLE DLE. The
receiver reverses the processes, replacing every occurrence of DLE DLE
with a single DLE.
Example: If the frame contained ``A B DLE D E DLE'', the characters
transmitted over the channel would be ``DLE STX A B DLE DLE D E DLE
DLE DLE ETX''.
Disadvantage: character is the smallest unit that can be
operated on;
not all architectures are byte oriented.
20
Byte stuffing and unstuffing
24
BIT STUFFING EXAMPLE
25
PHYSICAL LAYER CODING VIOLATIONS
This Framing Method is used only in those networks in which
Encoding on the Physical Medium contains some redundancy.
Some LANs encode each bit of data by using two Physical Bits
i.e. Manchester coding is Used. Here, Bit 1 is encoded into high-
low(10) pair and Bit 0 is encoded into low-high(01) pair.
this scheme means that every data bit has a transition in the middle,
making it easy for the receiver to locate the bit boundaries. The
combinations high-high and low-low are not used for data but are
used for delimiting frames in some protocols.
Reflection Spot-1
1Q. The functions of a Logical Link Control Layer (LLC) are ___.
A) Error control
B) Flow control
C) Creating and managing the communication link between
two devices with the help of the Transport layer.
D) All the above
Ans:D
2Q. The two sub-layers of a Data Link layer are ___.
A) LLC - Logical Link Control Layer
B) MAC - Medium Access Control Layer
C) Both A and B
D) Data Layer
Ans:C
3Q. The physical address to each machine is provided by which layer
in an OSI reference model?
A) Physical layer
B) Data Link Layer
C) Network Layer
D) Transport Layer
Ans:B
Lecture Outcomes (LOs)
After completion of this lecture, students will be
able to…
LO1. understand design issues of data link
layer
Lecture Level practice Problems (LLPs)
LLP1 (based on LO1)
1Q.What are the two 2 basic services of the data link layer?
1. Allows the upper layers to access the media using techniques such as framing.
2. Controls how data is placed onto the media and is received from the media using
techniques such as media access control and error detection.
2Q. What is the difference between network layer and data
link layer?
Network layer: Handles the routing and sending of data between different
networks. The most important protocols at this layer are IP and ICMP.
2. Data link layer: Handles communications between devices on the same
network.
3Q.What are the 4 functions of data link layer?
At the sender's side, DLL receives packets from the Network layer
divides them into small frames
sends each frame bit-by-bit to the physical layer.
It also attaches some special bits (for error control and addressing) at the header
and end of the frame.
Further Reading