Data link layer is most reliable node to node delivery of data.
It forms frames from the packets that are received from network layer and gives it to physical layer.
It also synchronizes the information which is to be transmitted over the data.
Error controlling is easily done. The encoded data are then passed to physical.
Error detection bits are used by the data link layer.
It also corrects the errors. Outgoing messages are assembled into frames.
Then the system waits for the acknowledgements to be received after the transmission.
It is reliable to send message.
Data link layer has two sub-layers:
§ Logical Link Control: It deals with protocols, flow-control, and error control
§ Media Access Control: It deals with actual control of media
There are many reasons such as noise, cross-talk etc., which may help data to get corrupted during transmission.
The upper layers work on some generalized view of network architecture and are not aware of actual hardware data processing.
Hence, the upper layers expect error-free transmission between the systems.
Most of the applications would not function expectedly if they receive erroneous data.
Applications such as voice and video may not be that affected and with some errors they may still function well.
Data-link layer uses some error control mechanism to ensure that frames (data bit streams) are transmitted with certain level of accuracy.
But to understand how errors is controlled, it is essential to know what types of errors may occur.
Types of Error:
§ Single Bit Error
§ Burst Error
Single Bit Error:
§ The term single bit error means that only one bit of a given data unit (such as byte character/data unit or packet) is changed from 1 to 0 or from 0 to 1.
§ It means that 2 or more bits in the data unit have changed from 1 to 0 from 0 to 1.
Error control mechanism may involve two possible ways:
§ Error Detection
§ Error Correction
§ Errors in the received frames are detected by means of Parity Check and Cyclic Redundancy Check (CRC).
§ In both cases, few extra bits are sent along with actual data to confirm that bits received at other end are same as they were sent.
§ If the counter-check at receiver’s end fails, the bits are considered corrupted.
Vertical Redundancy Check:
§ It is also known as Parity Check.
§ In this method, one extra bit is sent along with the original bits to make number of 1s either even in case of even parity, or odd in case of odd parity.
§ The sender while creating a frame counts the number of 1s in it. For example, if even parity is used and number of 1s is even then one bit with value 0 is added.
§ This way number of 1s remains even. If the number of 1s is odd, to make it even a bit with value 1 is added.
§ The receiver simply counts the number of 1s in a frame.
§ If the count of 1s is even and even parity is used, the frame is considered to be not-corrupted and is accepted.
§ If the count of 1s is odd and odd parity is used, the frame is still not corrupted.
§ If a single bit flips in transit, the receiver can detect it by counting the number of 1s.
§ But when more than one bits are error neous, then it is very hard for the receiver to detect the error.
Cyclic Redundancy Check:
§ CRC is a different approach to detect if the received frame contains valid data.
§ This technique involves binary division of the data bits being sent.
§ The divisor is generated using polynomials.
§ The sender performs a division operation on the bits being sent and calculates the remainder. Before sending the actual bits, the sender adds the remainder at the end of the actual bits.
§ Actual data bits plus the remainder is called a codeword.
§ The sender transmits data bits as code words.
§ At the other end, the receiver performs division operation on code words using the same CRC divisor.
§ If the remainder contains all zeros the data bits are accepted, otherwise it is considered as there some data corruption occurred in transit.
Error Correction can be done in two ways:
§ Backward Error Correction: When the receiver detects an error in the data received, it requests back the sender to retransmit the data unit.
§ Forward Error Correction: When the receiver detects some error in the data received, it executes error-correcting code, which helps it to auto-recover and to correct some kinds of errors