Professional Documents
Culture Documents
Data Link Layer
Data Link Layer
1
Overview
• Design issues
• Point-to-point links
2
Design issues
3
Design issues
• Services to network layer
• Unacknowledged connectionless service
• Acknowledged connectionless service
• Acknowledged connection-oriented service
4
Design issues: Services
Connectionless service Connection-oriented service
• Unacknowledged • Acknowledged
• Independent frames • Each frame received exactly
• Error rate should be low once
• Recovery left to higher layers • All frames received in the
• Used on LANs right order
• 3 distinct phases:
• Acknowledged • Establishment of
• No connection connection
• Acknowledgement for each • Data transfer
packet • Release of connection
• Resending
• Ack is optimisation; also
transport layer can handle
errors
5
Design issues: protocols
• Position of data link protocol
6
Design issues: protocols
• Position of data link protocol
7
Design issues: protocols
• Framing
• Break stream of bits up into discrete frames
• Error control
• How does a sender know that all packets are correctly received
• Flow control
• How to prevent a sender to overload the receiver with packets
8
Design issues: protocols
• Framing: break stream of bits up into discrete frames
• Methods:
• Use of time gap: unacceptable, too risky
• Character count
• Starting and ending characters with character stuffing
• Starting and ending flags with bit stuffing
• Physical layer coding violations
9
Design issues: protocols
• Framing: Character count
• Frame contains length (or #characters)
10
Design issues: protocols
• Framing: Character stuffing
DLE STX A B C D DLE ETX
• Frame starts / ends with special sequence of chars
• Allow all chars as data in frame?
• Stuffing: additional DLE before each DLE
A DLE C
11
Design issues: protocols
• Framing: Character stuffing – newer protocols
• Frame starts / ends with same char: FLAG
12
Design issues: protocols
• Framing: Bit stuffing
• Special bit pattern for start / end of frame
01111110
• In data: add ‘0’ after 5 consecutive ‘1’
13
Design issues: protocols
• Framing: Coding violation
• Redundancy in the encoding on a medium is required
• e.g. Manchester encoding: transition in the middle of a slot
15
Design issues: protocols
• Flow control
• How to prevent a sender to overload the receiver with
packets
• Receiver gives permission to send more packets
• Mechanisms:
• Implicit: ACK packet implies permission
• Explicit: communicate window size
16
Error Detection and Correction
1 Types of Errors
2 Detection
3 Error Correction
Error Detection and Correction
◼Data can be corrupted during transmission. For
reliable communication, error 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
Type of Errors
Type of Errors(cont’d)
• Single-Bit Error
~ is when only one bit in the data unit has
changed (ex : ASCII STX - ASCII LF)
Type of Errors(cont’d)
• Multiple-Bit Error
~ is when two or more nonconsecutive bits in
the data unit have changed(ex : ASCII B - ASCII LF)
Type of Errors(cont’d)
• Burst Error
~ means that 2 or more consecutive bits in the
data unit have changed
2 Detection
• Error detection uses the concept of redundancy,
which means adding extra bits for detecting errors
at the destination
Detection
• Redundancy
Detection
Four types of redundancy checks are used
in data communications
Vertical Redundancy Check
VRC
• Parity Check
• A parity bit is added to every data unit so that the total number of
1s(including the parity bit) becomes even for even-parity check or
odd for odd-parity check
• Simple parity check
Detection -examples
Example 1
31
Longitudinal Redundancy Check
LRC
33
Performance
36
• CRC generator
~ uses modular-2 division.
Binar11y D11iggvision
in a11
CRC Generator
100100 data=m
1101 divisor=r in terms of polynomial x3+x2+1
N=100100000 m+r
38
Detection(cont’d)
Binary Division
in a
CRC Checker
Detection(cont’d)
• Polynomials
• CRC generator(divisor) is most often represented not as
a string of 1s and 0s, but as an algebraic polynomial.
Detection(cont’d)
• A polynomial representing a divisor
Detection(cont’d)
• Standard polynomials
Checksum
• Checksum
~ used by the higher layer protocols
~ is based on the concept of redundancy(VRC,
LRC, CRC ….)
• Checksum Generator
Detection(cont’d)
• To create the checksum the sender does the
following:
• The unit is divided into K sections, each of n bits.
• Section 1 and 2 are added together using one’s
complement.
• Section 3 is added to the result of the previous step.
• Section 4 is added to the result of the previous step.
• The process repeats until section k is added to the result
of the previous step.
• The final result is complemented to make the checksum.
Detection(cont’d)
• data unit and checksum
Detection(cont’d)
Detection(cont’d)
( at a sender)
Original data : 10101001 00111001
10101001
00111001
--------------
11100010 Sum
00011101 Checksum
10101001 00111001 00011101
Detection(cont’d)
• Example ( at a receiver)
Received data : 10101001 00111001 00011101
10101001
00111001
00011101
---------------
11111111 Sum
00000000 Complement
Performance
The checksum detects all errors involving an odd
number of bits.
It detects most errors involving an even number of
bits.
If one or more bits of a segment are damaged and
the corresponding bit or bits of opposite value in a
second segment are also damaged, the sums of those
columns will not change and the receiver will not
detect a problem.