0% found this document useful (0 votes)
8 views

Dat Link Layer

Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Dat Link Layer

Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 71

Chapter 3

The Data Link Layer


Data Link Layer Design Issues
• Services Provided to the Network Layer
• Framing
• Error Control
• Flow Control
Functions of the Data Link Layer
Access
Control

Data Link
Error Framing
Layer
Control

Flow Physical
Control Addressing
Functions of the Data Link Layer (2)

Relationship between packets and frames.


Services Provided to Network Layer

(a) Virtual communication.


(b) Actual communication.
Services Provided to Network Layer
(2)

Placement of the data link protocol.


Type of Service offered by Data Link
Layer are :
a) Unacknowledged connectionless service.
b) Acknowledged connectionless service.
c) Acknowledged connection oriented service.
Framing

Different Framing methods


1. Character Count
2. Starting & Ending characters with character
stuffing.
3. Starting & Ending flags with bit stuffing.
4. Physical layer coding violations.
Character Count

A character stream. (a) Without errors. (b) With one error.


Starting & Ending characters with
character stuffing.

Disadvantage of this framing method is that it uses 8 bit characters


and ASCII code. It does not allow the arbitrary sized characters.
Starting & Ending flags with bit
stuffing

Bit stuffing happens in Data Link Layer.

The start and stop flag is indicated by the 8 bits : 01111110

The process of adding one extra 0 whenever five consecutive 1s follow a 0 in


the data, so that the receiver does not mistake the pattern 01111110 for a flag.
Error Detection and Correction

• Error-Detecting Codes
• Error-Correcting Codes
Error-Detecting Codes
a) Single-Bit Error
b) The term single-bit error means that only one bit of a given data
unit (such as a byte, character, data unit, or packet) is changed from
1 to 0 or from 0 to 1.
c) In figure below shows, 00000010 (ASCII STX) was sent, meaning
start of text, but 00001010 (ASCII LF) was received, meaning line
feed.
Single Bit Error
Burst Error
a) A burst error means that two or more bits in the data unit
have changed.
b) In figure below shows, 0100010001000011 was sent, but
0101110101000011 was received. The length of the burst
is measured from the first corrupted bit to the last
corrupted bit.
c) Burst error is most likely to happen in a serial
transmission. The duration of noise is normally longer
than the duration of bit, which means that when noise
affects data, it affects a set of bits. The number of bits
affected depends on the data rate and duration of noise.
Burst Error
Error Detection Techniques
(Redundancy)
Data Data Redundant
Bits

Generator

Redundancy Checker

Sender Data+ Redundant Bits Receiver


Types of redundancy check/Error
detection Methods of Codes
a) Vertical Redundancy Check (VRC)/Parity Check
b) Longitudinal Redundancy Check (LRC).
c) Cyclic Redundancy Check (CRC).
d) Checksum.
Vertical Redundancy Check
(VRC)/Parity Check
Receiver
Sender
Data Accept Data Reject Data
1 1 0 0 1 1 1

Parity Bit or
VRC
Even parity Generator Parity Checker (Count 1’s in
1
(Count 1’s in data) data + VRC)

1 1 0 0 1 1 1 1 1 1 0 0 1 1 1 1
Vertical Redundancy Check
(VRC)/Parity Check
Receiver
Sender
Data Accept Data Reject Data
1 1 0 0 1 1 1

Parity Bit or
VRC
Even parity Generator Parity Checker (Count 1’s in
1
(Count 1’s in data) data + VRC)

1 1 0 0 1 1 1 1 0 1 0 1 1 1 1 1

0 1 0 1 1 1 1 1
Longitudinal Redundancy Check
(LRC).
Contd..
However, if two bits in one data unit 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)
Requirements of CRC :

A CRC will be valid if and only if it satisfies the following


requirements:

1. It should have exactly one less bit than divisor.


2. Appending the CRC to the end of the data unit should result in
the bit sequence which is exactly divisible by the divisor.
The various steps followed in the CRC method are
1. A string of n as is appended to the data unit. The length of
predetermined divisor is n+ 1.
2. The newly formed data unit i.e. original data + string of n as are
divided by the divisor using binary division and remainder is
obtained. This remainder is called CRC.
3. Now, string of n Os appended to data unit is replaced by the CRC
remainder (which is also of n bit).
4. The data unit + CRC is then transmitted to receiver.
5. The receiver on receiving it divides data unit + CRC by the same
divisor & checks the remainder.
6. If the remainder of division is zero, receiver assumes that there is no
error in data and it accepts it.
7. If remainder is non-zero then there is an error in data and receiver
rejects it.
Contd..
Contd..
Example, if data to be transmitted is 1001 and predetermined divisor is

1011 .
Contd..
Polynomial codes
CRC generator using polynomials
Checksum
– The sender follows these steps:
• The unit is divided into k sections, each of n bits.
• All sections are added using one’s complement to get the
sum.
• The sum is complemented and becomes the checksum.
• The checksum is sent with the data.
– The receiver follows these steps:
• The unit is divided into k sections, each of n bits.
• All sections are added using one’s complement to get the
sum.
• The sum is complemented.
• If the result is zero, the data are accepted: otherwise, rejected.
Example Part 1
a) Suppose the following block of 16 bits is to be sent using a
checksum of 8 bits.
b) 10101001 00111001
c) The numbers are added using one’s complement
d) 10101001
e) 00111001
------------
Sum 11100010
f) Checksum 00011101
g) The pattern sent is 10101001 00111001 00011101
Example part 2
a) Now suppose the receiver receives the pattern sent in Example 7
and there is no error.
b) 10101001 00111001 00011101
c) When the receiver adds the three sections, it will get all 1s, which,
after complementing, is all 0s and shows that there is no error.
d) 10101001
e) 00111001
f) 00011101
g) Sum 11111111
h) Complement 00000000 means that the pattern is OK.
Error-Correcting Codes

Use of a Hamming code to correct burst errors.


Error-Detecting Codes

Calculation of the polynomial code checksum.


Elementary Data Link Protocols

• An Unrestricted Simplex Protocol


• A Simplex Stop-and-Wait Protocol
• A Simplex Protocol for a Noisy Channel
Protocol Definitions

Continued 

Some definitions needed in the protocols to follow.


These are located in the file protocol.h.
Protocol
Definitions
(ctd.)

Some definitions
needed in the
protocols to follow.
These are located in
the file protocol.h.
Unrestricted
Simplex
Protocol
Simplex
Stop-and-
Wait
Protocol
A Simplex Protocol for a Noisy Channel

A positive
acknowledgement
with retransmission
protocol.
Continued 
A Simplex Protocol for a Noisy Channel (ctd.)

A positive acknowledgement with retransmission protocol.


Sliding Window Protocols

• A One-Bit Sliding Window Protocol


• A Protocol Using Go Back N
• A Protocol Using Selective Repeat
Sliding Window Protocols (2)

A sliding window of size 1, with a 3-bit sequence number.


(a) Initially.
(b) After the first frame has been sent.
(c) After the first frame has been received.
(d) After the first acknowledgement has been received.
A One-Bit Sliding Window Protocol

Continued 
A One-Bit Sliding Window Protocol (ctd.)
A One-Bit Sliding Window Protocol (2)

Two scenarios for protocol 4. (a) Normal case. (b) Abnormal


case. The notation is (seq, ack, packet number). An asterisk
indicates where a network layer accepts a packet.
A Protocol Using Go Back N

Pipelining and error recovery. Effect on an error when


(a) Receiver’s window size is 1.
(b) Receiver’s window size is large.
Sliding
Window
Protocol
Using Go
Back N

Continued 
Sliding Window Protocol Using Go Back N

Continued 
Sliding Window Protocol Using Go Back N

Continued 
Sliding Window Protocol Using Go Back N
Sliding Window Protocol Using Go Back N (2)

Simulation of multiple timers in software.


A Sliding Window Protocol Using Selective Repeat

Continued 
A Sliding Window Protocol Using Selective Repeat (2)

Continued 
A Sliding Window Protocol Using Selective Repeat (3)

Continued 
A Sliding Window Protocol Using Selective Repeat (4)
A Sliding Window Protocol Using Selective Repeat (5)

(a) Initial situation with a window size seven.


(b) After seven frames sent and received, but not acknowledged.
(c) Initial situation with a window size of four.
(d) After four frames sent and received, but not acknowledged.
Protocol Verification

• Finite State Machined Models


• Petri Net Models
Finite State Machined Models

(a) State diagram for protocol 3. (b) Transmissions.


Petri Net Models

A Petri net with two places and two transitions.


Petri Net Models (2)

A Petri net model for protocol 3.


Example Data Link Protocols

• HDLC – High-Level Data Link Control


• The Data Link Layer in the Internet
High-Level Data Link Control

Frame format for bit-oriented protocols.


High-Level Data Link Control (2)

Control field of
(a) An information frame.
(b) A supervisory frame.
(c) An unnumbered frame.
The Data Link Layer in the Internet

A home personal computer acting as an internet host.


PPP – Point to Point Protocol

The PPP full frame format for unnumbered mode operation.


PPP – Point to Point Protocol (2)

A simplified phase diagram for bring a line up and down.


PPP – Point to Point Protocol (3)

The LCP frame types.

You might also like