2 Module2 - Data Link - 1
2 Module2 - Data Link - 1
Class-TE Sem-V
Data Link Layer Design Issues
• Network layer services
• Framing
• Error control
• Flow control
Packets and Frames
• Relationship between packets and frames
Framing Methods
1.Byte count / Character count.
2.Flag bytes with byte stuffing.
3.Flag bits with bit stuffing.
Framing (1)
Framing (2)
Bit stuffing. (a) The original data. (b) The data as they appear on
the line. (c) The data as they are stored in the receiver’s memory after destuffing.
Question
• A bit string, 0111101111101111110, needs to be transmitted at the data link layer. What
is the string actually transmitted after bit stuffing?
Answer
• The output is 011110111110011111010
Question
• Given the output after byte-stuffing: FLAG A B ESC ESC C ESC ESC ESC FLAG
• ESC FLAG D F FLAG. What is the original data?
Answer
• A B ESC C ESC FLAG FLAG D F
• The following character encoding is used in a data link protocol:
• A: 01000111; B: 11100011; FLAG: 01111110; ESC: 11100000
• Show the bit sequence transmitted (in binary) for the four-
character frame:
• A B ESC FLAG when each of the following framing methods are
used:
• (a) Character count
• (b) Flag bytes with byte stuffing.
• (c) Starting and ending flag bytes, with bit stuffing.
Answer
• a) 00000100 01000111 11100011 11100000 01111110
• b) 01111110 01000111 11100011 11100000 11100000 11100000 01111110 01111110
• c) 01111110 01000111 110100011 11100000 011111010 0111110
Question
• Given the output after byte-stuffing: FLAG A B ESC ESC C ESC ESC ESC FLAG
• ESC FLAG D FLAG. What is the original data?
Answer
• Error detection and correction are implemented either at the data link layer or
the transport layer of the OSI model.
Types of Errors
• Single bit error
• Burst error
Single-bit error
Burst error
• Theterm burst error means that two or more bits in the
data unit have changed from 1 to 0 or from 0 to 1.
• Burst errors does not necessarily mean that the errors
occur in consecutive bits, the length of the burst is
measured from the first corrupted bit to the last corrupted
bit. Some bits in between may not have been corrupted.
Error Detection
• Errordetection means to decide whether the received data
is correct or not without having a copy of the original
message.
0 0 1 1 1 0 0 1
1 0 1 0 1 0 0 1
• LRC -> 1 0 1 0 1 0 1 0
Longitudinal Redundancy Check
LRC
Performance
• LCR increases the likelihood of detecting burst errors.
• If two bits in one data units are damaged and two bits in exactly the same positions in
another data unit are also damaged, the LRC will not detect an error.
Example-If two bits in one data units are damaged and two bits in exactly the same
positions in another data unit are also damaged, the LRC will not detect an error.
• Odd no of 1’S=1
1 1 1 0 0 1 1 1
• Even no of 1’s=0
1 0 0 1 1 1 0 1
0 1 1 1 1 0 0 1
1 0 1 0 1 0 0 1
• LRC ->
1 0 1 0 1 0 1 0
• Find the LRC for the data blocks 01110111 10101001 01101001 10101010 and
determine the data that is transmitted.
• Odd no of 1’S=1 0 1 1 1 0 1 1 1
1 0 1 0 1 0 0 1
• Even no of 1’s=0
0 1 1 0 1 0 0 1
1 0 1 0 1 0 1 0
0 0 0 1 1 1 0 1
Two dimensional parity check
1 0 0 1 1 0 0 1 0
1 1 1 0 0 0 1 0 0
0 0 1 0 0 1 0 0 0
1 0 0 0 0 1 0 0 0
1 1 0 1 1 0 1 1 0
1 0 0 0 1 1 0 1
🡪 1 bit error
How many errors you can detect?
01101001 10110100 00001110 11101011 10010110
10001101
0 1 1 0 1 0 0 1
1 0 1 1 0 1 0 0
0 0 0 0 1 1 1 0
1 1 1 0 1 0 1 1
1 0 0 1 0 1 1 0
1 0 0 0 1 1 0 1
🡪 2 bit error
Checksum
• Sender side- checksum created
• Receiver side – checksum validated
Operation at sender side
1.Break the original message in to ‘k’ number of blocks with ‘n’ bits in each block .
2.Sum all ‘k’ data blocks.
3.Add the carry to the sum , if any.
4.Do 1’s complement to the sum = Checksum.
Operation at receiver side
• The unit is divided into k sections, each of n bits.
• All sections are added together using one’s complement to get the sum.
• The sum is complemented.
• If the result is zero, the data are accepted: otherwise, they are rejected
Example-
10011001 11100010 00100100 10000100
• Find the redundant bits using checksum method.
• 00001010 10101010 01010101 10100000
• Find the redundant bits using checksum method.
• 00001010 10101010 01010101 10100000
• Sum=10101010
• Checksum=01010101
Cyclic Redundancy Check
CRC
Steps Involved-
At sender side,
•A string of n 0’s is appended to the data unit to be transmitted.
•Here, n is one less than the number of bits in CRC generator.
•Binary division is performed of the resultant string with the CRC generator.
•After division, the remainder so obtained is called as CRC.
•It may be noted that CRC also consists of n bits.
At sender side,
•The CRC is obtained after the binary division.
•The string of n 0’s appended to the data unit earlier is replaced by the CRC remainder.
•The newly formed code word (Original data + CRC) is transmitted to the receiver.
Step-04: Checking at Receiver Side-
At receiver side,
•The transmitted code word is received.
•The received code word is divided with the same CRC generator.
•On division, the remainder so obtained is checked.