Slide - 5.1 Data Link Layer
Slide - 5.1 Data Link Layer
Computer Networks
Lecture 6 – Data Link Layer
Presented By
Prof. Dr. Boshir Ahmed
Professor
Dept. of Computer Science & Engineering
Rajshahi University of Engineering & Technology
1
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Data Link Layer
Data Link Layer is second layer of OSI Layered Model. This layer is one of the most
complicated layers and has complex functionalities and liabilities.
2
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Note
• Framing: Data-link layer takes packets from Network Layer and encapsulates them into Frames.
Then, it sends each frame bit-by-bit on the hardware. At receiver’ end, data link layer picks up
signals from hardware and assembles them into frames.
• Addressing: Data-link layer provides layer-2 hardware addressing mechanism. Hardware address
is assumed to be unique on the link. It is encoded into hardware at the time of manufacturing.
• Error Control: Sometimes signals may have encountered problem in transition and the bits are
flipped. These errors are detected and attempted to recover actual data bits. It also provides error
reporting mechanism to the sender.
• Flow control: Stations on same link may have different speed or capacity. Data-link layer ensures
flow control that enables both machine to exchange data on same speed.
• Access control: When host on the shared link tries to transfer the data, it has a high probability of
collision. Data-link layer provides mechanism (such as CSMA/CD) to equip capability of accessing a
shared media among multiple Systems.
6
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Framing
• Link layer accepts packets from the network layer, and encapsulates them into frames
that it sends using the physical layer; reception is the opposite process.
7
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Framing Method
1)Byte count
2)Flag bytes with byte stuffing
3)Flag bytes with bit stuffing
4)Physical layer coding violations
- (Use non-data symbol to indicate frame)
***Many DL protocols use a combination of the above framing methods for additional safety
8
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
1. Byte count
9
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
2. Flag Bytes with Byte Stuffing
10
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Error Control
11
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Error
• Error is a situation when the sender's data does not match the data
at the receiver's end.
12
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Types of Error
• Single bit Error: When there is a change in only one bit of the sender's data then it is called a
single bit error.
• Burst Error: When there is a change in two or more bits of the sender’s data then it is called a
burst error.
13
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Error Control
Error Control is a process of detecting and correcting/retransmitting the data which has been lost or corrupted
during the transmission of data. Any reliable system must have a mechanism for detecting and correcting such
errors.
14
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Error Control (cont.)
1. Error Detection :
Error detection simply means detection or identification of errors.
2. Error Correction :
Error correction, as name suggests, simply means correction or solving or fixing of errors. It
simply means reconstruction and rehabilitation of original data that is error-free. But error
correction method is very costly and is very hard.
15
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Error Detection and Correction Methods
***Error detection/correction adds redundant bit with data so errors can be either detected, or corrected.
16
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Simple Parity Check
A redundant bit called a parity bit is added to every data unit so the total number of 1s in the unit
(including the parity bit) become even.
Example:
17
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Sender Node Receiver Node
Accept Data
Data
Yes
1100001 Reject
Data
Even
No 1?
Calculate
Parity Bit Count Bits
1100001 1 Bits
Transmission Medium
18
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
2D Parity Check
In simple parity checker parity bits are calculated for each row. But in two-dimensional parity check, a
block of bits is divided into rows & column and a redundant row of bits is added to the whole block.
19
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
3. Checksum
20
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
3. Checksum – Operation at sender side
1. Break the original message in to 'k' number of blocks with 'n' bits in each block.
2. Sum all the 'k' data blocks.
3. Add the carry to the sum, if any.
4. Do 1's complement to the sum = Checksum.
21
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
22
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
23
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Example
Now suppose the receiver receives given the pattern sent using 8-bit checksum:
10101001 00111001 00011101
Check if there is any error.
Solution 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.
10101001
00111001
00011101
Sum 11111111
Complement 00000000 means that the pattern is OK.
Parity
bits
26
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Hamming Code (cont.)
Steps:
1. Calculation of total numbers of redundant bits.
27
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000
Hamming Code (cont.)
Watch This:
https://www.youtube.com/watch?v=373FUw-2U2k
28
McGraw-Hill ©The McGraw-Hill Companies, Inc., 2000