Computer_Networks_Ch5_DataLink_Layer
Computer_Networks_Ch5_DataLink_Layer
(PCC-CS 602)
Instructor
Bikash Choudhury
Assistant Professor
Department of Computer Science & Engineering
Ramkrishna Mahato Government Engineering College Purulia
Contents
The data link layer is responsible for moving frames from one hop (node) to the next.
Bikash Choudhury, 2023
Data Link Layer
• Framing: The data link layer divides the stream of bits received from the network
layer into manageable data units called frames.
• Physical Addressing: If frames are to be distributed to different systems on the
network, the data link layer adds a header to the frame to define the sender and/or
receiver of the frame. If the frame is intended for a system outside the sender’s
network, the receiver address is the address of the device that connects the
network to the next one.
• Flow Control: If the rate at which the data are absorbed by the receiver is less
than the rate at which data are produced in the sender, the data link layer imposes
a flow control mechanism to avoid overwhelming the receiver.
• Error Control: The data link layer adds reliability to the physical layer by adding
mechanisms to detect and retransmit damaged or lost frames. It also uses a
mechanism to recognize duplicate frames. Error control is normally achieved
through a trailer added to the end of the frame.
• Access Control: When two or more devices are connected to the same link, data
link layer protocols are necessary to determine which device has control over the
link at any given time.
https://www.tutorialspoint.com/framing-in-data-link-layer
Bikash Choudhury, 2023
Parts of a Frame
Framing
• The trouble with the algorithm is that the count can be modified by a
transmission error.
• This leads to a synchronization problem.
• Character/Byte count method is rarely used.
• Bit stuffing was developed for the HDLC (High-Level Data Link
Control) protocol. Each frame begins and ends with a special bit
pattern, 01111110. This pattern is a flag byte.
• The length of the frame in both byte/bit stuffing depends on the
contents of the data it carries.
Errors
Error
Detection
Cyclic
Parity Bit Redundancy Checksum
Check (CRC)
we divide our message into blocks, each of k bits, called datawords. We add r
redundant bits to each block to make the length n = k + r. The resulting n-bit blocks
are called codewords.
Bikash Choudhury, 2023
Error Detection (Odd & Even Parity Bit)
Data Even Parity Odd Parity
000 0 1
001 1 0
010 1 0
011 0 1
100 1 0
101 0 1
110 0 1
111 1 0
Received Data:
After computing the 2D parity if both Row and Column parities are matched with the
received parity then the received data is not corrupted
Bikash Choudhury, 2023
Example: 2D-Parity (2 bits error)
Received Data: 100101010 111000100 001001000 100001000 110110110
1 0 0 1 0 1 0 1 0 0
1 1 1 0 0 0 1 0 0 0
0 0 1 0 0 1 0 0 0 0
1 0 0 0 0 1 0 0 0 0
1 1 0 1 0 1 1 1 0 0
After computing the 2D parity if both Row and Column parities are matched with the
received parity then the received data is not corrupted. Here we received 2 error bits.
1 0 0 1 0 1 0 1 0 0
1 1 1 0 0 0 1 0 0 0
0 0 1 0 1 0 0 0 0 0
1 0 0 0 0 1 0 0 0 0
1 1 0 1 1 0 1 1 0 0
After computing the 2D parity if both Row and Column parities are matched with the
received parity then the received data is not corrupted. Here we received no error bits.
The table shows data received by a receiver and has n corrupted bits. What is the mini-
mum possible value of n? GATE-2008
(A) 1 (B) 2 (C) 3 (D) 4 Bikash Choudhury, 2023
Example: 2D-Parity (4 bits error)
d7 d6 d5 d4 d3 d2 d1 d0 d7 d6 d5 d4 d3 d2 d1 d0
r0 0 1 0 1 0 0 1 1 r0 0 1 0 1 0 0 1 1
r1 1 1 0 0 1 1 1 0 r1 1 1 0 0 1 1 1 0
r2 0 0 0 1 0 1 0 0 r2 0 0 0 1 0 1 0 0
r3 0 1 1 0 1 0 1 0 r3 0 1 1 0 1 0 1 0
r4 1 1 0 0 0 1 1 0 r4 1 1 0 0 0 1 1 0
r0 0 1 0 1 0 0 1 1 r0 0 1 0 1 0 0 1 1
r1 1 1 0 0 1 1 1 0 r1 1 1 0 0 1 1 1 0
r2 0 0 0 1 0 1 0 0 r2 0 0 0 1 0 1 0 0
r3 0 1 1 0 1 0 1 0 r3 0 1 1 0 1 0 1 0
r4 1 1 0 0 0 1 1 0 r4 1 1 0 0 0 1 1 0
https://www.tutorialspoint.com/what-is-algorithm-for-computing-the-crc
Thus, for the given CRC generator, the corresponding binary pattern is 1000011
D4 D3 D2 22 D1 21 20
Sol:
We know, 2P ≥ D+P+1
2P ≥ 4+P+1 [D=4]
23 ≥ 4+3+1 [Consider P=3]
8 ≥8 [Satisfied]
P4 4 5 6 7 P4 1 1 0 1 P4 = 1
P2 2 3 6 7 P2 0 1 0 1 P2 = 0
P4 4 5 6 7 P4 0 1 0 1 P4 = 0
P2 2 3 6 7 P2 1 1 0 1 P2 = 1
P4 4 5 6 7 P4 0 1 0 1 P4 = 0
P2 2 3 6 7 P2 1 0 0 1 P2 = 0
P4 4 5 6 7 P4 0 1 0 1 P4 = 0
P2 2 3 6 7 P2 0 1 0 1 P2 = 0
P4 4 5 6 7 P4 0 1 0 1 P4 = 0