Introduction To Data Link Layer in Computer Networks
Moving forward in this series , now its time for us to explore the next layer in the OSI model i.e. Data Link Layer . Datalink layer is the second layer in OSI reference model. It is above the physical layer.
Responsibilities of the data link layer include framing, addressing, flow control, error control, and media access control. The data link layer divides the stream of bits received from the network layer into manageable data units called frames. It further adds a header to define the addresses of the sender and receiver of the frame
During data transmission, it may happen that some error may get introduced and there is non-zero propagation delay between the instant a bit is sent and the instant at which it is received. This layer basically deals with frame formation, flow control, error control, addressing, and link management.
The data link layer also adds reliability to the physical layer by adding mechanisms to detect and re-transmit damaged, duplicate, or lost frames. 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.
we will discuss each of the properties (listed above) of the data link layer in detail in the subsequent posts. Now let us understand each function in brief :
Link management : The communication link between the source and destination is required to be initiated. maintained and finally terminated for the effective exchange of data.
Control and data on same link : The data and control information are combined in a frame and transmitted from the source to the destination machine. The control info needs to be separated from the data.
Addressing : When many machines are connected together (LAN). the identity of any individual machines must be specified while transmitting the data frames.
Frame synchronization : The source machine sends data in the form of blocks called frames to the destination machine. The starting and ending of each frame should be identified so that the frames can be recognized by the destination machine.
Error Control : The errors introduced during transmission from source to destination machines must be detected and corrected at the destination machine.
Flow Control : The source machine must not send data frames at a rate faster than the capacity of the destination machine to accept them.
Services provided to Network Layer by DLL (Data Link Layer) ?
Data link layer can be designed to offer different types of services to the network layer. Some of them are as follows :
1. Unacknowledged connectionless service
In this type of service, the destination machine does not send back any acknowledgment after receiving frames. It is a connectionless service. So no connection is established before communication or released after it is over. If a frame is lost due to channel noise, then there are no attempts made to recover it.
So this service is suitable only if the error rate is low. It is suitable for any real-time traffic such as speech. This type of service is highly unreliable.
2. Acknowledged connectionless service
This is the next step to improve reliability. In this service, there are no connections established for data transfer but for each· frame received, the receiver sends an acknowledgment to the sender. If a frame is not received within some specified time it is assumed to be lost and the sender will re-transmit it.
3. Acknowledged Connection-Oriented Service
The source and destination machines establish a connection before transferring the data. A specific number is given to each frame being sent and the data link layer guarantees that each transmitted frame is received.
All the frames are guaranteed to be received in the same order as the order of transmission. Each received frame will be acknowledged individually by the destination machine.
What is Framing in DLL (Data Link Layer) ?
The bits to be transmitted are first broken into discrete frames at the data link layer. In order to guarantee that the bitstream is error-free, the checksum of each frame is computed. Data transmission in the physical layer basically means moving the bits in the form of a signal from the source to the destination.
The data link layer further needs to pack bits into frames, so that each frame is distinguishable from another. Our postal system practices a type of framing. If it is different from the checksum present in the frame, then the data link layer knows that an error has occurred. It then discards the bad frame and sends back a request for retransmission.
Frames can be of fixed or variable size. In a fixed-size framing, there is no need for defining the boundaries of the frames, the size itself can be used as a delimiter.
Breaking the bitstream into frames is called framing. One way of doing it is by inserting time gaps between frames. But practically this framing technique does not work satisfactorily, because networks generally do not make any guarantees about the timing.
Framing Methods in Data Link Layer !!
Character count method : In this method, a field in the header is used to specify the number of characters in the frame. This number helps the receiver to know the exact number of characters present in the frame following this count.
Starting and ending characters, with character stuffing : In this, we use starting character before the starting of each frame and an ending character at the end of each frame. Each frame will be preceded by the transmission of ASCII character sequence DLE STX.
Character Stuffing : The data link layer at the sending end inserts an ASCII DLE character just before each accidental DLE character in the data being transmitted. The data link layer at the receiving end will remove these DLE characters before transferring the data to the network layer.
Physical Layer Coding Violations : This method of framing is applicable only to those networks in which the encoding on the physical medium contains some redundancy. Some LANs encode each bit of data using two physical bits.
In the next post, we will see the important protocols implemented in this layer for efficient data transmission. So stay tuned..
Aric is a tech enthusiast , who love to write about the tech related products and ‘How To’ blogs . IT Engineer by profession , right now working in the Automation field in a Software product company . The other hobbies includes singing , trekking and writing blogs .