Data Link Layer
Data Link Layer
The Data Link Layer is the second layer of the OSI (Open Systems Interconnection) model. It plays a crucial role
in providing reliable communication over the physical transmission medium by organizing data into frames and
ensuring that errors and flow are controlled. This layer essentially acts as an intermediary between the raw
physical medium and higher-level network functions.
The Data Link Layer is responsible for moving frames from one device to another over a physical link. It ensures
that the data is error-free by managing how devices on the same network segment communicate and share the
physical medium. This layer deals with framing, addressing, error detection, correction, and flow control.
1. Logical Link Control (LLC): Responsible for identifying network protocols, error detection, and flow
control.
2. Media Access Control (MAC): Handles how devices access the network medium and manage physical
addressing (MAC addresses).
1. Framing: Data from the Network Layer is divided into frames (1500 bytes) , which are structured units of
data that the Data Link Layer can manage. Each frame includes a header, data payload, and a trailer
(with error-checking information).
2. Addressing: The Data Link Layer uses MAC (Media Access Control) addresses to identify devices on the
same local network. Each network interface card (NIC) is assigned a unique MAC address.
o Error Detection: The Data Link Layer checks for errors in frames using methods like Cyclic
Redundancy Check (CRC) or parity bits. It detects transmission errors that might occur due to
interference or noise in the physical medium.
o Error Correction: Some protocols at this layer implement mechanisms to correct errors. If an
error is detected, the frame may be retransmitted.
4. Flow Control: This ensures that the sender does not overwhelm the receiver by sending data too
quickly. Flow control manages the pace at which frames are sent, ensuring that both sides can handle
the amount of data being transmitted.
5. Access Control: In networks where multiple devices share the same medium, such as Ethernet or Wi-Fi,
the Data Link Layer handles when and how devices can transmit data. This avoids collisions in a shared
medium.
6. Physical Addressing: While the Network Layer deals with logical addressing (e.g., IP addresses), the Data
Link Layer uses physical (MAC) addresses. When a frame is sent, the MAC address of both the sender
and the receiver is included in the frame header.
7. Medium Access Control: This is a protocol sublayer that determines how devices can access and share
the communication medium. In a broadcast medium (like Ethernet), it ensures that devices avoid
collisions when sending data simultaneously.
In networking, managing how multiple devices share the same communication channel is crucial for maintaining
smooth and efficient data transfer. There are two key protocols designed to handle this task are Carrier Sense
Multiple Access with Collision Detection (CSMA/CD) and Carrier Sense Multiple Access with Collision Avoidance
(CSMA/CA). CSMS/CD is used for wired networks where CSMA/CA used in wireless networks.
• When a frame is ready, the sender checks whether the transmission link is idle or busy. For this, it
continuously senses transmissions from other nodes.
• If it senses that the carrier is free, it sends the data. Otherwise, it waits for the link to become idle.
• Once sender transmits its frame on the link. CSMA/CD does not use an ‘acknowledgment’ system. It
checks for successful and unsuccessful transmissions through collision signals. During transmission, if a
collision signal is received by the node, transmission is stopped. The station then transmits a jam signal
onto the link and waits for random time intervals before it resends the frame. After some random time,
it again attempts to transfer the data and repeats the above process.
• If no collision was detected in propagation, the sender marks it successful frame transmission.
• Although CSMA/CS detects collisions, it does not have a mechanism to reduce the number of collisions.
Hence, it is not appropriate for large networks, as the performance degrades exponentially when more
stations are added.
• When a frame is ready, the sender checks whether the channel is idle or busy.
• If the channel is not clear, the node starts to wait for a random amount of time before checking to see if
it is clear. This waiting period of time is known as the "back off time".
• The sender then waits for acknowledgement from the receiver. If it receives the acknowledgement
before expiry of timer, it marks a successful transmission.
• Otherwise, it waits for a back-off time period and restarts the algorithm.
It only reduces the data recovery Whereas CSMA/ CA minimizes the possibility
time. of collision.
CSMA/CD resends the data frame CSMA/CA first transmit the intent to send for
whenever a conflict occurs. data transmission.