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

Unit II.pptx

Unit II covers error detection, correction, and data link control within the data link layer of networking, detailing various coding techniques such as block coding, cyclic codes, and error detection methods like parity checks and checksums. It also discusses flow control protocols, framing methods, and the handling of noisy and noiseless channels through mechanisms like Stop-and-Wait ARQ and Go-Back-N ARQ. The unit emphasizes the importance of the data link layer in ensuring reliable data transmission and managing errors effectively.

Uploaded by

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

Unit II.pptx

Unit II covers error detection, correction, and data link control within the data link layer of networking, detailing various coding techniques such as block coding, cyclic codes, and error detection methods like parity checks and checksums. It also discusses flow control protocols, framing methods, and the handling of noisy and noiseless channels through mechanisms like Stop-and-Wait ARQ and Go-Back-N ARQ. The unit emphasizes the importance of the data link layer in ensuring reliable data transmission and managing errors effectively.

Uploaded by

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

UNIT II

Error Detection, Correction And Data


Link Control.
UNIT II
https://www.youtube.com/watch?v=
bdFRCmzayyw&ab_channel=Educatio
n4u
Content
• Data Link Layer: Data Link Layer Services
• Error Detection and Correction
• Linear Block Codes: hamming code, Hamming Distance, parity check code.
• Cyclic Codes: CRC (Polynomials), Advantages of Cyclic Codes,
• Other Cyclic Codes (Examples: CHECKSUM: One's Complement, Internet Checksum).
• Framing: fixed-size framing, variable size framing.
• Flow control: flow control protocols.
• Noiseless channels: simplest protocol, stop-and-wait protocol.
• Noisy channels: stop-and-wait Automatic Repeat Request (ARQ), go-back-n ARQ, Selective repeat
• ARQ, piggybacking.

3
Data Link Layer
• The data link layer is the protocol layer in a program that handles the moving of
data into and out of a physical link in a network. The data link layer is Layer 2 in
the Open Systems Interconnection (OSI) architecture model for a set of
telecommunication protocols.
• Data bits are encoded, decoded, and organized in the data link layer, before they
are transported as frames between two adjacent nodes on the same LAN or
WAN. The data link layer also determines how devices recover from collisions that
may occur when nodes attempt to send frames at the same time.
• The data link layer has two sublayers: the logical link control (LLC) sublayer and
the media access control (MAC) sublayer.

4
Data Link Layer
• As described by the IEEE 802 LAN specification, the role of the LLC sublayer is to
control data flow among various applications and services, as well as provide
acknowledgment and error notification mechanisms. The LLC sublayer can then
talk to a number of IEEE 802 MAC sublayers, which control access to the physical
media for transport. It is also responsible for the physical addressing of frames.

• Two common MAC layer types include Ethernet and 802.11 wireless specifications

5
Data Link Layer
• Data link layer and error detection
• The data link layer ensures an initial connection has been set up, divides output data into
data frames, and handles the acknowledgments from a receiver that the data arrived
successfully. It also ensures incoming data has been received successfully by analyzing bit
patterns at particular places in the frames.
• If an error occurs, the data link layer notifies higher-level protocols that something has
happened to the physical link. Frame sequencing capabilities within the data link layer
permit the receiving device to reorder frames that might have been transmitted out of
sequence. The data link layer verifies that the packet is unimpaired.
• The data link layer also manages flows by enabling devices on a link to detect congestion.
Nearby devices then transmit congestion information so that traffic can be rerouted
accordingly.

6
Data Link Layer
Functions of the data link layer

• The data link layer has three main functions:

• It handles problems that occur as a result of bit transmission errors.

• Itensures data flows at a pace that doesn't overwhelm sending and


receiving devices.

• It permits the transmission of data to Layer 3, the network layer, where it is


addressed and routed.

7
Error Detection and Correction Techniques

• Block Coding
• Linear Block Coding
- Simple Parity Check
- Hamming Codes
• Cyclic Codes
• Checksum

8
Block Coding
• In digital electronics, block coding is a technique of
encoding data into a specific format.

• It is mainly used to detect and correct errors that occur in


the information during transmission and storage.

• This is done by adding a block code of redundant


information to the main data.

9
Block Coding
• Block coding is mainly employed to create a robust method of data transmission
and storage.

• In block coding, data is encoded by splitting it into multiple blocks of a fixed size
and applying encoding techniques to each of these blocks separately

10
Block Coding (Datawords and codewords in block coding)
• In block coding, 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.

11
Types of Errors
• There are three types of error
1. Single bit error
2. Multiple bits error
3. Burst error

12
Types of Errors
Single Bit Error: In a received frame, there is only one bit corrupted.

13
Types of Errors
Multiple bits error − In the received frame, more than one bit is corrupted.

14
Types of Errors
Burst error − In the received frame, more than one consecutive bits are
corrupted.

15
Error Detection Techniques
• To detect errors, a common technique is to introduce redundancy bits that
provide additional information. Various techniques for error detection
include::
1. Simple Parity Check
2. Two-dimensional Parity Check
3. Checksum
4. Cyclic Redundancy Check (CRC)

16
Simple Parity Check
• Simple-bit parity is a simple error detection method that involves adding an
extra bit to a data transmission. It works as:
• 1 is added to the block if it contains an odd number of 1’s, and
• 0 is added if it contains an even number of 1’s
• This scheme makes the total number of 1’s even, that is why it is called
even parity checking.

17
Simple Parity Check

18
Simple Parity Check
• Disadvantages
• Single Parity check is not able to detect even no. of bit error.
• For example, the Data to be transmitted is 101010. Codeword transmitted
to the receiver is 1010101 (we have used even parity).
Let’s assume that during transmission, two of the bits of code word flipped
to 1111101.
On receiving the code word, the receiver finds the no. of ones to be even
and hence no error, which is a wrong assumption.

19
Simple Parity Check
• Two-dimensional Parity Check
• Two-dimensional Parity check bits are calculated for each row, which is
equivalent to a simple parity check bit. Parity check bits are also calculated
for all columns, then both are sent along with the data. At the receiving
end, these are compared with the parity bits calculated on the received
data.

20
Two-dimensional Parity Check

21
Redundancy: To Detect or Correct an Error

22
23
24
Example: K=2 and n=3

Example: 000 received then data word 00 error undetectable


25
26
Linear Block Coding
• It is a simple error control coding technique used for
error detection and correction.
• Information data is partitioned into blocks of length K pieces for example
Information word.
• Every information word is then coded into a block of length n bits called a
codeword. Here, n > k
• Also, n = k + r, where ‘r ‘ denotes the parity bits or check bits added to every
information word.
• Vector documentation is utilized for the Data word and Codeword: message
m = (m1, m2 mn ), Codeword c = (c1, c2 cn).

27
28
Two Dimensional Parity Check

29
Finding Hamming Distance between pairs of words

30
31
• Eg dataword 0100 codeword 0100011 received
codeword 0100011 (syndrome =000 no error)

dataword 0111 codeword 0111001 received


0011001 (syndrome =011 error b2 bit )

32
CRC Encoder and Decoder

33
34
Eg. CRC Encoder

35
CRC Decoder No Error in Codeword

36
CRC Decoder Detecting Error

37
CRC Code Analysis

38
39
40
41
Checksum
• Set of Numbers (7, 11, 12, 0, 6),

• we send (7, 11, 12,0,6,36)

• where 36 is the sum of the original numbers.

42
checksum
• (complement) of the sum, called the checksum.

• In this case, we send (7, 11, 12,0,6, -36). The receiver can add all the numbers.

• received (including the checksum). If the result is 0, it assumes no error;


otherwise, there is an error.

43
one's complement

• In one's complement arithmetic, a negative number can be represented


by inverting all bits (changing a 0 to a 1 and a 1 to a 0).

• This is the same as subtracting the number from 2n - 1

44
45
Data Link Layer: Data Link Control

46
Outline
• Framing
• Byte vs. bit-oriented protocols

• Data Link Control


• Flow control
• Error control

• Protocols

47 47
Framing
• Process of wrapping data with certain info before sending it out.

48 48
Byte vs. Bit Oriented
• Framing in byte-oriented protocols

• Framing in bit-oriented protocols

49 49
Byte Stuffing
• Process of adding extra byte whenever there is an escape or a flag character in the
data

50 50
Bit Stuffing
• Process of adding extra bit to ensure flag sequence does not appear in the data

01111110

51
Data Link Protocols

52
"Simplest" Mechanism
• Assuming
• Noiseless channel

• Unlimited buffer and


speed for the
receiver.

53
"Simplest" : Pseudo Code
• Sender

• Receiver

54
"Simplest": Flow Diagram

55
Stop-and-Wait Mechanism
• Still noiseless channel

• Receiver has limited buffer


• Requires flow control

• Sender sends one frame at a time and wait for an acknowledgment

56
Stop-and-Wait: Overview

57
Stop-and-Wait: Pseudo Code

• Sender side

58
Stop-and-Wait: Pseudo Code
• Receiver side

59
Stop-and-Wait: Flow Diagram

60
Stop-and-
Wait ARQ

61
Flow Diagram: Normal Operation
Sender Receiver

S=0 Frame 0 R=0


Deliver
ACK 1
S=1 R=1
Frame 1
Deliver
ACK 0
R=0

Time Time
62
Flow Diagram: Lost Frame
Sender Receiver

S=0 Frame 0 R=0


Deliver
ACK 1
S=1 R=1
Frame 1

Timeout
Frame 1

Deliver
ACK 0
R=0

63
Time Time
Flow Diagram: Lost ACK
Sender Receiver

S=0 Frame 0 R=0


Deliver
ACK 1
S=1 R=1
Frame 1

Deliver
ACK 0
Timeout R=0
S=1 Frame 1 Frame 0 expected;
discard

ACK 0
R=0
S=0

Time Time 64 64
Flow Diagram: Delayed ACK
Sender Receiver

S=0 Frame 0 R=0


Deliver
1
ACK R=1
Timeout Frame 0
Frame 0 expected;
discard
S=1 Frame 1 ACK 1
R=1
Timeout Frame 1

Deliver
ACK 0 R=0
S=0
65
Go-Back-N ARQ
• Allows multiple frames to be sent before waiting for ACK
• These frames must be numbered differently
• Frame numbers are called Sequence numbers

• Frames must be received in the correct order

• If a frame is lost, the lost frame and all of the following frames must be
retransmitted

66
Go-Back-N ARQ
• The key features of the Go-Back-N (GBN) protocol include:
• Sliding window mechanism
• Sequence numbers
• Cumulative acknowledgements
• Timeout mechanism
• NACK mechanism
• Simple implementation.

67
Go-Back-N: Animation
• https://aboelela.site/profile/projects/net-seal/animations/go-back-n-arq/

68 68
Sequence Numbers
• Frame header contains m bits for sequence number

• That allows up to 2m different frame numbers

• How big should m be?

69
Sending Window
• Sending more than one frame at once requires sender to buffer multiple frames
• Known as "sending window"
• Any of these frames in the window can be lost

70
"Sliding" Window
• Once the first frames in the
window is ACKed
• ACKed frames are removed
from the buffer
• More frames are transmitted
• Result: The window slides to
the right

71 71
Receiving Window
• Receiver expects one frame at a time

72 72
Send vs. Receive Windows

73 73
Go-Back-N: Window Sizes
• For m-bit sequence numbers

• Send window size: at most 2m-1


→ Up to 2m-1 frames can be sent without ACK

• Receive window size: 1


→ Frames must be received in order

74 74
Go-Back-N: Normal Operation

75 75
Go-Back-N: Lost Frame
ACKs are
cumulative

76 76
Selective Repeat: Animation
• https://aboelela.site/profile/projects/net-seal/animations/selective-repeat-arq/

77 77
Selective Repeat ARQ
• Go-Back-N always discards out-of-order frames
• Losing one frame may result in retransmission of multiple frames
• Very inefficient in noisy link

• Selective Repeat ARQ allows frames to be received out of order


• Therefore, receive window > 1

78 78
Selective Repeat ARQ
• key features include:
• Receiver-based protocol
• Each packet is individually acknowledged by the receiver
• Only lost packets are retransmitted, reducing network congestion
• Maintains a buffer to store out-of-order packets
• Requires more memory and processing power than Go-Back-N
• Provides efficient transmission of packets.

79 79
Send and Receive Windows
• Sender and receiver share window space equally

• For m-bit sequence numbers


• Send window: up to 2m-1
• Receive window: up to 2m-1

80 80
Send Window

81 81
Receive Window

82 82
Negative ACK

• Used by receiver to
indicate missing
frame

83 83
CASE STUDY
DATA LINK CONTROL
PROTOCOLS:
HDLC AND PPP
HDLC
• High-level Data Link Control

• Bit-oriented protocol

• Support both
• Point-to-point links
• Multipoint links

86 86
Normal Response Mode

• "NRM" mode
• Used in both
point-to-point
and multi-point
link.

87 87
Asynchronous Balance Mode
• "ABM"
• Supports only point-to-point links
• Each station is both primary and secondary

88 88
HDLC Frames
•Information frame (I-frame)

Frame Check Sequence


(error detection code)
•Supervisory frame (S-frame)

•Unnumbered frame (U-frame)

89 89
PPP
• Point-to-Point Protocol
• Byte-oriented protocol

• Most common protocol for point-to-point access


• Dial-up access
• ADSL
• GPRS/3G

90 90
PPP Frame Format

• Escape byte: 01111101


• Control field uses HDLC's U-frame format
• No flow or error control

91 91
PPP Transition States

92 92
PPP Stack
• Link Control Protocol (LCP)

• Authentication Protocol (AP)

• Network Control Protocol (NCP)

93 93
LCP: Link Control Protocol
• Responsible for establishing, maintaining, configuring, and terminating links

94 94
LCP Packets

95
PPP Authentication
• Two protocols are supported:
• Password Authentication Protocol (PAP)
• Challenge Handshake Authentication Protocol (CHAP)

96 96
NCP: Network Control Protocol
• A set of control protocols to allow data from the network layer to be
encapsulated into a PPP frame

• One common protocol: IPCP


(Internetwork Protocol Control Protocol)
• Allow negotiation at the network layer

97 97
Internet Protocol Control Protocol

98

You might also like