Download as pdf or txt
Download as pdf or txt
You are on page 1of 50

Data link layer

1
Overview
• Design issues

• Point-to-point links

• Local area Networks

• Data Link layer Switching


• Services
• Protocols

2
Design issues

• Algorithms protocols services

for achieving reliable, efficient communication


between systems connected by a “wire-like”
communication channel

• Errors on communication circuits


• Finite data rate
• Nonzero propagation delay
• Finite processing speed

3
Design issues
• Services to network layer
• Unacknowledged connectionless service
• Acknowledged connectionless service
• Acknowledged connection-oriented service

• Services from physical layer


• Unreliable bit transport

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)

• Out of synchronisation if error

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

DLE STX A DLE DLE C DLE ETX


• Char set
• DLE: Data link escape
• STX: Start Text
Too closely linked to ASCII
• ETX: End Text

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

• Use no transition in a slot (= coding violation) as start of frame


14
Design issues: protocols
• Error control
• How does a sender know that all packets are correctly received?
• ACK packet by receiver
• Packet lost or not recognized at receiver?
• Timer at sender: resend packet
• How to handle duplicates or out of order received packets?
• Sequence number in packet and ACK packet
• Optimisation: NACK packet
• Inform sender that something strange happened

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

Suppose the sender wants to send the word world. In


ASCII the five characters are coded as
1110111 1101111 1110010 1101100 1100100
The following shows the actual bits sent
11101110 11011110 11100100 11011000 11001001
Detection – examples
Example 2
Now suppose the word world in Example 1 is received by
the receiver without being corrupted in transmission.
11101110 11011110 11100100 11011000 11001001
The receiver counts the 1s in each character and comes
up with even numbers (6, 6, 4, 4, 4). The data are
accepted.
Detection – examples
Example 3

Now suppose the word world in Example 1 is corrupted


during transmission.
11111110 11011110 11101100 11011000 11001001
The receiver counts the 1s in each character and comes
up with even and odd numbers (7, 6, 5, 4, 4). The receiver
knows that the data are corrupted, discards them, and asks
for retransmission.
Performance
It can detect single bit error
It can detect burst errors only if the total number
of errors is odd.

31
Longitudinal Redundancy Check
LRC

Two –Dimensional Parity Check


LRC

33
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
checker will not detect an error.
Cyclic Redundancy Check
CRC
CRC
• Given a k-bit frame or message, the transmitter
generates an n-bit sequence, known as a frame
check sequence (FCS), so that the resulting frame,
consisting of (k+n) bits, is exactly divisible by some
predetermined number.
• The receiver then divides the incoming frame by
the same number and, if there is no remainder,
assumes that there was no error.

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

Tx----- 100100001 100000001 Rx not equal to 0


Rx =0 remainder

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.

You might also like