0% found this document useful (0 votes)
108 views48 pages

2 Module2 - Data Link - 1

The document discusses various data link layer design issues and error detection methods used at the data link layer including framing, error control, flow control, parity checks, checksums, and cyclic redundancy checks. It provides examples and explanations of how each method works.

Uploaded by

gulati.paranjay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
108 views48 pages

2 Module2 - Data Link - 1

The document discusses various data link layer design issues and error detection methods used at the data link layer including framing, error control, flow control, parity checks, checksums, and cyclic redundancy checks. It provides examples and explanations of how each method works.

Uploaded by

gulati.paranjay
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 48

COMPUTER NETWORKS

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)

A frame delimited by flag bytes.


Four examples of byte sequences before and after byte stuffing.
Framing (3)

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

• A B ESC C ESC FLAG FLAG D


Error Detection Methods
• Basic concepts
• Networks must be able to transfer data from one device to another with complete
accuracy.

• Data can be corrupted during transmission.

• For reliable communication, errors must be detected and corrected.

• 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.

• Errordetection uses the concept of redundancy, which


means adding extra bits for detecting errors at the
destination.
Redundancy
Vertical Redundancy Check
VRC
Performance
• It can detect single bit error
• It can detect burst errors only if the total number of errors is odd.

• Sender: 11100001 -> Transmission error -> 11000001 ->


• Receiver rejects this error
• Sender: 11100001 -> Transmission error -> 10100101 ->
• Receiver accepts this error

• Even number errors can not detect.


• Append the parity bit after each block shown below
using VRC.
• 110110
1110110
• 101111
1101111
• 110010
1110010
Longitudinal Redundancy Check
LRC
• The parity bit is calculated for each column and sent along with the data.
• The block of parity acts as a the redundant bits
Example
• Find the LRC for the data blocks 11100111 11011101 00111001 10101001 and determine
the data that is transmitted.
• Odd no of 1’S=1
1 1 1 0 0 1 1 1
• Even no of 1’s=0
1 1 0 1 1 1 0 1

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

Transmitted frames will be-> 100110010 111000100 001001000 100001000 110110110


Example: The following bit stream is enclosed using VRC,LRC, and even parity
Locate and correct the error if present
11000011 11110011 10110010 00001010 00101010 00101011 10100011 01001011
11100001
1 1 0 0 0 0 1 1
1 1 1 1 0 0 1 1
1 0 1 1 0 0 1 0
0 0 0 0 1 0 1 0
0 0 1 0 1 0 1 0
0 0 1 0 1 0 1 1
1 0 1 0 0 0 1 1
0 1 0 0 1 0 1 1
1 1 1 0 0 0 0 1
How many errors you can detect?
01101001 10110100 00001101 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 0 1
1 1 1 0 1 0 1 1
1 0 0 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-

Error detection using CRC technique involves the following steps-

Step-01: Calculation Of CRC At Sender Side-

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.

Step-02: Appending CRC To Data Unit-

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.

Step-03: Transmission To Receiver-

•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.

The following two cases are possible-


Case-01: Remainder = 0

If the remainder is zero,


•Receiver assumes that no error occurred in the data during the transmission.
•Receiver accepts the data.
Case-02: Remainder ≠ 0

If the remainder is non-zero,


•Receiver assumes that some error occurred in the data during the transmission.
•Receiver rejects the data and asks the sender for retransmission.

You might also like