0% found this document useful (0 votes)
5 views49 pages

CN-Unit - 3 Notes - AR20 - REC

The document covers the Data Link Layer in computer networks, focusing on framing, error control, and flow control protocols. It discusses various protocols such as Simplex Stop and Wait, Go-Back-N, and Selective Repeat, along with error detection and correction techniques including redundancy and Hamming distance. The course objectives aim to help students understand the Data Link Layer's functionality and analyze its protocols for effective communication.

Uploaded by

buradabalaji66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views49 pages

CN-Unit - 3 Notes - AR20 - REC

The document covers the Data Link Layer in computer networks, focusing on framing, error control, and flow control protocols. It discusses various protocols such as Simplex Stop and Wait, Go-Back-N, and Selective Repeat, along with error detection and correction techniques including redundancy and Hamming distance. The course objectives aim to help students understand the Data Link Layer's functionality and analyze its protocols for effective communication.

Uploaded by

buradabalaji66
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 49

Dr.P.M.Manohar, Dept.

of CSE, Raghu Engineering College(A), Visakhapatnam,


Computer Networks – Unit 3 – Data Link Layer

Unit -III

The Data Link Layer-Framing-Error Control-Flow Control, Error Detection and


Correction-Error-Correcting Codes-Error Detecting Codes. Elementary Data Link
Protocols- A Utopian Simplex Protocol-A Simplex Stop and Wait Protocol for
an Error free channel-A Simplex Stop and Wait Protocol for a Noisy Channel,
Sliding Window Protocols-A One Bit Sliding Window Protocol-A Protocol Using
Go-Back-N, A Protocol Using Selective Repeat.

COURSE OBJECTIVES:
The objectives of studying of Computer Networks-Unit-3 are as follows
1. Understand the functioning of Data link layer in OSI Model.

COURSE OUTCOMES
Upon the completion of the Unit-3 the students will be able to:
1. Analyze protocols implemented in data link layer for error and flow
control

Framing
• Data link layer needs to pack bits into frames, so that each frame is distinguishable
from another

• Separate a message from one source to a destination, or from other messages to other
destinations, by adding a sender address and a destination address

• Fixed-size framing: ATM

• Variable-size framing

– Need a way to define the end of the frame and the beginning of the next

– Character-oriented approach and bit-oriented approach

Character-Oriented Protocols

• Frame structure

1
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Byte stuffing: process of adding 1 extra byte whenever there is a flag or escape character in
the text

Bit-Oriented Protocols

• Frame structure

Bit stuffing: process of adding one extra 0 whenever five consecutive 1s follow a 0 in the data

Flow and Error Control

• Data link control = flow control + error control


2
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• Flow control refers to a set of procedures used to restrict the amount of data that the
sender can send before waiting for acknowledgement

• Error control in the data link layer is based on automatic repeat request (ARQ), which is
the retransmission of data

• ACK, NAK(Negative ACK), Piggybacking (ACKs and NAKs in data frames)

Error Detection and Correction

Type of Errors

• An electromagnetic signal is subject to interference from heat, magnetism, and other


forms of electricity

• Single-bit error: 0 → 1 or 1 → 0

• Burst error: 2 or more bits have changed

Single-Bit Error

• Only one bit of a given data unit is changed

• The least likely type of error in serial transmission

• Single-bit error can happen in parallel transmission

Burst Error

• Two or more bits in the data unit have changed

• Burst error does not necessarily mean that the errors occur in consecutive bits

• Most likely to happen in a serial transmission

3
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• Number of bits affected depends on the data rate and duration of noise

Redundancy

• Error detection uses the concept of redundancy, which means adding extra (redundant)
bits for detecting errors at the destination

Error Control

• Detection Versus Correction

– Detection: error ? yes or no

– Correction: Need to know the exact number of bits that are corrupted, and
their location in the message

• Forward Error Correction Versus Retransmission

– Retransmission (resending) : Backward error correction

• Coding for redundancy: Forward Error Correction

– Block coding:

– Convolution coding

4
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Modular Arithmetic

• In modulo-N arithmetic, we use only the integers in the range 0 to N-1, inclusive.

• Adding: 0+0=0 0+1=1 1+0=1 1+1=0

• Subtracting: 0 – 0 = 0 0–1=1 1–0=1 1–1=0

• XORing of two single bits or two words

Block Coding

• Divide the message into blocks, each of k bits, called datawords.

• Add r redundant bits to each block to make the length n = k + r. The resulting n-bit
blocks are called codewords

• Example: 4B/5B block coding

– k = 4 and n = 5.

2k = 16 datawords and 2n = 32 codewords.

5
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Error Detection in Block Coding

• Example:

Assume that k = 2 and n = 3

(Table 10.1)

Error Detection: Example

• Assume the sender encodes the dataword 01 as 011 and sends it to the receiver.
Consider the following cases:

1. The receiver receives 011 which is a valid codeword. The receiver extracts the dataword 01
from it.

2. The codeword is corrupted during transmission, and 111 is received. This is not a valid
codeword and is discarded.

3. The codeword is corrupted during transmission, and 000 is received. This is a valid codeword.
The receiver incorrectly extracts the dataword 00. Two corrupted bits have made the error
undetectable.

→ An error-detecting code can detect only the types of errors for which it is designed;
other types of errors may remain undetected

6
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Error Correction in Block Coding

• Example:

Assume that k = 2 and r = 3

n = 5 (Table 10.2)

Error Correction: Example

• Assume the dataword is 01. The sender creates the codeword 01011. The codeword is
corrupted during transmission, and 01001 is received. First, the receiver finds that the
received codeword is not in the table. This means an error has occurred. The receiver,
assuming that there is only 1 bit corrupted, uses the following strategy to guess the
correct dataword

1. Comparing the received codeword with the first codeword in the table (01001 versus
00000), the receiver decides that the first codeword is not the one that was sent because there
are two different bits. (the same for third or fourth one in the table)

2.. The original codeword must be the second one in the table because this is the only one that
differs from the received codeword by 1 bit.

Hamming Distance

• The Hamming distance between two words is the number of differences between
corresponding bits.

• Example: Hamming distance d(10101, 11110) is 3

7
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• The minimum Hamming distance is the smallest Hamming distance between all
possible pairs in a set of words

• Example for Table 10.1

- dmin = 2

• Three parameters to define the coding schemes

– Codeword size n

– Dataword size k

– The minimum Hamming distance dmin

– Coding scheme C(n, k) with a separate expression for dmin

• Hamming distance and error

– Hamming distance between the received codeword and the sent codeword is
the number of bits that are corrupted

– Minimum distance for error detection

– To guarantee the detection of up to s errors in all cases, the minimum Hamming


distance in a block code must be dmin = s + 1.

Minimum Hamming Distance: Example

• The minimum Hamming distance in Table 10.1 is 2. This code guarantees detection of
only a single error.

For example, if the third codeword (101) is sent and one error occurs, the received
codeword does not match any valid codeword. If two errors occur, however, the received
codeword may match a valid codeword and the errors are not detected.

• In Table 10.2, it has dmin = 3. This code can detect up to two errors.

When any of the valid codewords is sent, two errors create a codeword which is not in the
table of valid codewords. The receiver cannot be fooled. However, some combinations of three
errors change a valid codeword to another valid codeword. The receiver accepts the received
codeword and the errors are undetected.

Geometric Concept for Finding dmin for Error Detection

• dmin must be an integer greater than s: that is,

8
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

dmin = s + 1.

• To guarantee correction of up to t errors in all cases, the minimum Hamming distance in


a block code must be dmin = 2t + 1

Linear Block Codes

• Almost all block codes used today belong to a subset called linear block codes.

• A linear block code is a code in which the exclusive OR (addition modulo-2) of two
valid codewords creates another valid codeword

• The minimum Hamming distance is the number of 1s in the nonzero valid codeword with
the smallest number of 1s

Linear Block Code: Parity-Check Code

• A simple parity-check code is a single-bit error-detecting code in which n = k + 1 with


dmin = 2.

9
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Encoder and Decoder for Parity-Check Code

• The result of addition over all 5 bits: syndrome

2 Dimensional Parity-Check Code

10
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Noiseless Channels: Simplest Protocol

• Simplest protocol with no flow or error control

11
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Simplest Protocol

• Sender-site algorithm

• Receiver-site algorithm

Note: For more Explanation refer text book

12
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Stop-and-Wait Protocol

• Simple tokens of ACK and flow control added

• Sender-site algorithm

• Receiver-site algorithm

13
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Stop-and-Wait Protocol: Example

Note: For more Explanation refer text book

Noisy Channels: Stop-and-Wait ARQ

• Stop-and-wait Automatic Repeat Request (ARQ)

• Error correction in Stop-and-Wait ARQ is done by keeping a copy of the sent frame
and retransmitting of the frame when the timer expires

• In Stop-and-Wait ARQ, we use sequence numbers to number the frames. The sequence
numbers are based on modulo-2 arithmetic

• Acknowledgment number always announces in modulo-2 arithmetic the sequence


number of the next frame expected.

14
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• Sender-site algorithm

15
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• Receiver-site algorithm

16
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Stop-and-Wait ARQ: Example

Note: For more Explanation refer text book

Go-Back-N ARQ

• Pipelining improves the efficiency of the transmission

• In the Go-Back-N Protocol, the sequence numbers are modulo 2m, where m is the size
of the sequence number field in bits

• The send window is an abstract concept defining an imaginary box of size 2m − 1 with
three variables: Sf, Sn, and Ssize

• The send window can slide one or more slots when a valid acknowledgment arrives.

17
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• Receive window for Go-Back-N ARQ

• The receive window is an abstract concept defining an imaginary box of size 1 with
one single variable Rn. The window slides when a correct frame has arrived; sliding
occurs one slot at a time.

• Sliding windows, Timers, ACK, Resending a frame

18
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Go-Back-N ARQ: Send Window Size

• In Go-Back-N ARQ, the size of the send window must be less than 2m; the size of the
receiver window is always 1

• Stop-and-Wait ARQ is a special case of Go-Back-N ARQ in which the size of the send
window is 1

19
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Go-Back-N ARQ: Sender Algorithm

20
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Go-Back-N ARQ: Receiver Algorithm

21
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Go-Back-N ARQ: Example 1

Go-Back-N ARQ: Example 2

Note: For more Explanation refer text book

22
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Selective Repeat ARQ

• Sender window size

• Receive window size

23
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Selective Repeat ARQ: Window Size

• The size of the sender and receiver window must be at most one-half of 2m

24
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Selective Repeat ARQ: Sender-Site Algorithm

Selective Repeat ARQ: Receiver-Site Algorithm

25
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Selective Repeat ARQ: Example

Note: For more Explanation refer text book

Piggybacking

• To improve the efficiency of the bidirectional protocols

• Piggybacking in Go-Back-N ARQ

26
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Error Detection and Correction

Type of Errors

• An electromagnetic signal is subject to interference from heat, magnetism, and other


forms of electricity

• Single-bit error: 0 → 1 or 1 → 0

• Burst error: 2 or more bits have changed

Single-Bit Error

• Only one bit of a given data unit is changed

• The least likely type of error in serial transmission

27
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• Single-bit error can happen in parallel transmission

Burst Error

• Two or more bits in the data unit have changed

• Burst error does not necessarily mean that the errors occur in consecutive bits

• Most likely to happen in a serial transmission

• Number of bits affected depends on the data rate and duration of noise

Redundancy

• Error detection uses the concept of redundancy, which means adding extra (redundant)
bits for detecting errors at the destination

Error Control

• Detection Versus Correction

– Detection: error ? yes or no

28
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

– Correction: Need to know the exact number of bits that are corrupted, and
their location in the message

• Forward Error Correction Versus Retransmission

– Retransmission (resending) : Backward error correction

• Coding for redundancy : Forward error correction

– Block coding

– Convolution coding

Modular Arithmetic

• In modulo-N arithmetic, we use only the integers in the range 0 to N-1, inclusive.

• Adding: 0+0=0 0+1=1 1+0=1 1+1=0

• Subtracting: 0 – 0 = 0 0–1=1 1–0=1 1–1=0

• XORing of two single bits or two words

Block Coding

• Divide the message into blocks, each of k bits, called datawords.

• Add r redundant bits to each block to make the length n = k + r. The resulting n-bit
blocks are called codewords

• Example: 4B/5B block coding

– k = 4 and n = 5.

2k = 16 datawords and 2n = 32 codewords.

29
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Error Detection in Block Coding

• Example:

Assume that k = 2 and n = 3

(Table 10.1)

Error Detection: Example

• Assume the sender encodes the dataword 01 as 011 and sends it to the receiver.
Consider the following cases:

1. The receiver receives 011 which is a valid codeword. The receiver extracts the dataword 01
from it.

2. The codeword is corrupted during transmission, and 111 is received. This is not a valid
codeword and is discarded.

3. The codeword is corrupted during transmission, and 000 is received. This is a valid codeword.
The receiver incorrectly extracts the dataword 00. Two corrupted bits have made the error
undetectable.

→ An error-detecting code can detect only the types of errors for which it is designed;
other types of errors may remain undetected

30
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Error Correction in Block Coding

• Example:

Assume that k = 2 and r = 3

n = 5 (Table 10.2)

Error Correction: Example

• Assume the dataword is 01. The sender creates the codeword 01011. The codeword is
corrupted during transmission, and 01001 is received. First, the receiver finds that the
received codeword is not in the table. This means an error has occurred. The receiver,
assuming that there is only 1 bit corrupted, uses the following strategy to guess the
correct dataword

1. Comparing the received codeword with the first codeword in the table (01001 versus
00000), the receiver decides that the first codeword is not the one that was sent because there
are two different bits. (the same for third or fourth one in the table)

2.. The original codeword must be the second one in the table because this is the only one that
differs from the received codeword by 1 bit.

Hamming Distance

• The Hamming distance between two words is the number of differences between
corresponding bits.

• Example: Hamming distance d(10101, 11110) is 3

31
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• The minimum Hamming distance is the smallest Hamming distance between all
possible pairs in a set of words

• Example for Table 10.1

- dmin = 2

• Three parameters to define the coding schemes

– Codeword size n

– Dataword size k

– The minimum Hamming distance dmin

– Coding scheme C(n, k) with a separate expression for dmin

• Hamming distance and error

– Hamming distance between the received codeword and the sent codeword is
the number of bits that are corrupted

– Minimum distance for error detection

– To guarantee the detection of up to s errors in all cases, the minimum Hamming


distance in a block code must be dmin = s + 1.

Minimum Hamming Distance: Example

• The minimum Hamming distance in Table 10.1 is 2. This code guarantees detection of
only a single error.

For example, if the third codeword (101) is sent and one error occurs, the received
codeword does not match any valid codeword. If two errors occur, however, the received
codeword may match a valid codeword and the errors are not detected.

• In Table 10.2, it has dmin = 3. This code can detect up to two errors.

When any of the valid codewords is sent, two errors create a codeword which is not in the
table of valid codewords. The receiver cannot be fooled. However, some combinations of three
errors change a valid codeword to another valid codeword. The receiver accepts the received
codeword and the errors are undetected.

Linear Block Codes

• Almost all block codes used today belong to a subset called linear block codes.

32
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• A linear block code is a code in which the exclusive OR (addition modulo-2) of two
valid codewords creates another valid codeword

• The minimum Hamming distance is the number of 1s in the nonzero valid codeword with
the smallest number of 1s

Linear Block Code: Parity-Check Code

• A simple parity-check code is a single-bit error-detecting code in which n = k + 1 with


dmin = 2.

Encoder and Decoder for Parity-Check Code

• The result of addition over all 5 bits: syndrome

33
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

2 Dimensional Parity-Check Code

Linear Block Code: Hamming Code

• All Hamming codes discussed in our textbook have dmin = 3.

• The relationship between m and n in these codes is n = 2m − 1

34
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Encoder and Decoder for Hamming Code

Hamming Code

• r0 = a2 + a1 + a0 modulo-2

• r1 = a3 + a2 + a1 modulo-2

• r2 = a1 + a0 + a3 modulo-2

• s0 = b2 + b1 + b0 + q0 modulo-2

• s1 = b3 + b2 + b1 + q1 modulo-2

• s2 = b1 + b0 + b3 + q2 modulo-2

35
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Logical Decision by Decoder

• Let us trace the path of three datawords from the sender to the destination:

1 The dataword 0100 becomes the codeword 0100011. The codeword 0100011 is received.
The syndrome is 000, the final dataword is 0100.

2. The dataword 0111 becomes the codeword 0111001. The codeword 0011001 received. The
syndrome is 011. After flipping b2 (changing the 1 to 0), the final dataword is 0111.

3. The dataword 1101 becomes the codeword 1101000. The codeword 0001000 received (two
errors). The syndrome is 101. After flipping b0, we get 0000, the wrong dataword. This shows
that our code cannot correct two errors.

Cyclic Code: CRC

• Cyclic codes are special linear block codes with one extra property.

• If a codeword is cyclically shifted (rotated), the result is another codeword

• Cyclic Redundancy Check (CRC)

36
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

CRC Encoder and Decoder

Division in CRC Encoder

37
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Division in CRC Decoder

Polynomials

• Degree of a polynomial: the highest power in the polynomial

Example: x6 + x + 1 → the degree ‘6’

Polynomial Operation

• Adding and subtracting polynomials

(x5 + x4 + x2) + (x6 + x4 + x2) → x6 + x5

• Multiplying two polynomials

(x5 + x3 + x2 + x) (x2 + x1 + 1)

= x7 + x6 + x5 +x5 + x4 + x3 + x4 + x3 + x2 + x3 + x2 + x

38
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

= x7 + x6 + x3 + x

• Dividing one polynomial by another

• Shifting

Shifting left 3 bits: 10011 becomes 10011000

Shifting right 3 bits: 10011 becomes 10 (x4 + x + 1, x )

CRC Division Using Polynomials

The divisor in a cyclic code is normally called the generator polynomial or simply the
generator.

Cyclic Code Analysis

f(x) is a polynomial with binary coefficients

Dataword: d(x) Codeword: c(x) Generator: g(x)

Syndrome: s(x) Error: e(x)

In a cyclic code,

1. If s(x) ≠ 0, one or more bits is corrupted.

2. If s(x) = 0, either
a. No bit is corrupted. Or

b. Some bits are corrupted, but the decoder failed to detect them

Received codeword = c(x) + e(x)

39
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Received codeword/g(x) = c(x)/g(x) + e(x)/g(x)

In a cyclic code, those e(x) errors that are divisible by g(x) are not caught

Error Detection

• Single-bit error

If the generator has more than one term and the coefficient of x0 is 1, all single errors
can be caught.

• Two isolated single-bit error

If a generator cannot divide xt + 1 (t between 0 and n – 1), then all isolated double
errors can be detected

Example 1

• Which of the following g(x) values guarantees that a single-bit error is caught? For
each case, what is the error that cannot be caught?

a. x + 1 b. x3 c. 1

Solution

a. No xi can be divisible by x + 1. Any single-bit error can be caught.

b. If i is equal to or greater than 3, xi is divisible by g(x). All single-bit errors in positions 1 to 3


are caught.

c. All values of i make xi divisible by g(x). No single-bit error can be caught. This g(x) is useless.

Example 2

• Find the status of the following generators related to two isolated, single-bit errors.

a. x + 1 b. x4 + 1 c. x7 + x 6+ 1 d. x15 + x14 + 1

Solution

a. This is a very poor choice for a generator. Any two errors next to each other cannot be
detected.

b. This generator cannot detect two errors that are four positions apart.

c. This is a good choice for this purpose.

40
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

d. This polynomial cannot divide xt + 1 if t is less than 32,768. A codeword with two isolated
errors up to 32,768 bits apart can be detected by this generator..

Error Detection

• Odd numbers of errors

A generator that contains a factor of x + 1 can detect all odd-numbered errors

• Burst errors

❏ All burst errors with L ≤ r will be detected.

❏ All burst errors with L = r + 1 will be detected with probability

1 – (1/2)r–1.

❏ All burst errors with L > r + 1 will be detected with probability

1 – (1/2)r.

Summary and Standard Polynomials

• A good polynomial generator needs to have the following characteristics:

1. It should have at least two terms.

2. The coefficient of the term x0 should be 1.

3. It should not divide xt + 1, for t between 2 and n − 1.

4. It should have the factor x + 1.

Checksum

• Tendency is to replace the checksum with a CRC

• Not as strong as CRC in error-checking capability

• One’s complement arithmetic

41
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

– We can represent unsigned numbers between 0 and 2n – 1 using only n bits

– If the number has more than n bits, the extra leftmost bits need to be added to
the n rightmost bits (wrapping)

– A negative number can be represented by inverting all bits. It is the same as


subtracting the number from 2n – 1

Checksum: Example

• The sender initializes the checksum to 0 and adds all data items and the checksum.
However, 36 cannot be expressed in 4 bits. The extra two bits are wrapped and
added with the sum to create the wrapped sum value 6. The sum is then
complemented, resulting in the checksum value 9 (15 − 6 = 9).

Internet Checksum

Sender site:

1. The message is divided into 16-bit words.

2. The value of the checksum word is set to 0.

3. All words including the checksum are added using one’s complement

addition.

4. The sum is complemented and becomes the checksum.

5. The checksum is sent with the data.

42
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Receiver site:

1. The message (including checksum) is divided into 16-bit words.

2. All words are added using one’s complement addition.

3. The sum is complemented and becomes the new checksum.

4. If the value of checksum is 0, the message is accepted; otherwise, it is

rejected.

Internet Checksum: Example

HDLC

High-level Data Link Control

Two common transfer mode: normal response mode (NRM) and asynchronous balanced mode
(ABM)

43
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

HDLC: Frames

• I(information)-frames, S(supervisory)-frames, U(unnumbered frame)-frames


• Flag field: 01111110 to identify both the beginning and the end of a frame and
serve as synchronization pattern for receiver
• FCS field: 2- or 4-byte ITU-T CRC for error detection

• Control Field: 1- or 2-byte segment of the frame used for flow and error control
• Determine the type of frame and define its functionality
• Control field for I-frame: P/F (poll/final bit for primary/secondary)

• Control field for S-frame


• Receive ready (RR), Receive not ready (RNR), Reject (REJ) Selective reject (SREJ)

44
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

Control field for U-frame

HDLC: Example 1

• Connection and disconnection

45
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• Piggybacking without error

46
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• Piggybacking with error

HDLC: Bit Stuffing and Unstuffing

Point-to-Point Protocol: PPP

• One of the most common protocols for point-to-point access

• Many Internet users who need to connect their home computer to the server of an
Internet service provider use PPP

• A point-to-point link protocol is required to control and manage the transfer of data

47
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

• PPP defines/provides

– the format of the frame to be exchanged between devices

– how two devices negotiate the establishment of the link and the exchange of
data

– how network layer data are encapsulated in the data link frame

– how two devices can authenticate each other

– multiple network layer services

– connection over multiple links

– Network address configuration

• But, several services are missing for simplicity

– no flow control, simple error control (detection and discard), no sophisticate


addressing for multipoint configuration

PPP Frame

Flag: 01111110 the same as HDLC, but it treated as a byte because of PPP is a byte-
oriented protocol

Address: 11111111 (broadcast address)

Control: No need because PPP has no flow control and limited error control

PPP is a byte-oriented protocol using byte stuffing with the escape byte 01111101

PPP: Transition States

48
Dr.P.M.Manohar, Dept.of CSE, Raghu Engineering College(A), Visakhapatnam,
Computer Networks – Unit 3 – Data Link Layer

PPP: Multiplexing

• PPP uses another set of other protocols to establish the link, authenticate the parties,
and carry the network layer data
• Three sets of protocols defined for powerful PPP: LCP, two APs, several NCPs

49

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy