Error Detection Neil Tang 9/26/2008

15
CS440 Computer Networks 1 Error Detection Error Detection Neil Tang Neil Tang 9/26/2008 9/26/2008

description

Error Detection Neil Tang 9/26/2008. Outline. Basic Idea Objectives Two-Dimensional Parity Checksum Algorithm Cyclic Redundancy Check (CRC). Basic Idea. Add redundant information to a frame that can be used to determine if errors have been introduced. - PowerPoint PPT Presentation

Transcript of Error Detection Neil Tang 9/26/2008

Page 1: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 1

Error DetectionError Detection

Neil TangNeil Tang9/26/20089/26/2008

Page 2: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 2

OutlineOutline

Basic Idea

Objectives

Two-Dimensional Parity

Checksum Algorithm

Cyclic Redundancy Check (CRC)

Page 3: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 3

Basic IdeaBasic Idea Add redundant information to a frame that can be used to determine

if errors have been introduced.

Sender: It applies the algorithm to the message to generate the redundant bits and then transmits the original message along with the extra bits.

Receiver: It applies the same algorithm on the received message to come up with a result then compares it with the expected results.

Page 4: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 4

Basic IdeaBasic Idea

Trivial Solution: always transmitting two complete copies.

Real Solutions: k redundant bits for n-bit messages, k<<n, e.g., CRC, k = 32bit, n = 12,000bits.

Page 5: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 5

ObjectivesObjectives

Maximize the probability of detecting errors.

Minimize the number of redundant bits.

Page 6: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 6

Two-Dimensional ParityTwo-Dimensional Parity

1011110 1

1101001 0

0101001 1

1011111 0

0110100 1

0001110 1

1111011 0

Paritybits

Paritybyte

Data

It can catch 1-, 2-, 3- and most 4-bits errors. Why?

14 redundant bits for 42-bit message. Good enough?

Page 7: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 7

Checksum AlgorithmChecksum Algorithm

Basic Ideas: The checksum is obtained by adding all words in the original message.

Internet Checksum Algorithms: Add 16-bit subsequences together using the ones complement arithmetic and then take the ones complement of the result as the checksum.

E.g., 1010

+) 1110

----------------------

1000

+) 1

-----------------------

1001 →0110

Page 8: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 8

Checksum AlgorithmChecksum Algorithm

Cost Effective: 16 bits for a message of any length

Inefficiency for Error Detection: a pair of single-bit errors may cause trouble.

Easy Implementation: Several lines of codes

Page 9: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 9

CRCCRC

(n+1) bit message can be represented as a polynomial of degree n. E.g., 10011010 → M(x) = 1x7+ 1x4+1x3+1x1

The sender and the receiver agree on a divisor polynomial C(x) with a degree of k, e.g., C(x)=x3+x2+1. C(x) is usually specified by the standards, e.g., in Ethernet, k=32, CRC-32.

Page 10: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 10

Polynomial ArithmeticPolynomial Arithmetic

B(x) can be divided by C(x) if same degree

The remainder can be obtained by performing XOR on each pair of matching coefficients. E.g., (x3+1) can be divided by (x3+x2+1) and the remainder is x2. How? 1001 XOR 1101 = 0100

Page 11: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 11

Algorithm to Obtain CRCAlgorithm to Obtain CRC Multiply M(x) by xk , i.e., attach k 0s at the end of the message. Call th

is extended message T(x). Divide T(x) by C(x) and find the remainder (CRC). Attach CRC to M(x) and send the new message.

Generator C(x) 110111111001

10011010000 Message T(x)1101

10011101

10001101

10111101

11001101

10001101

101 Remainder

Page 12: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 12

CRC AlgorithmCRC Algorithm

Sender: It applies the algorithm to obtain CRC (remainder). Attach CRC to the end of the original message (e.g., 10011010101) and send it.

Receiver: divides the received polynomial by C(x). If 0, no error; otherwise, corrupted.

Header Body

8 16 16 8

CRCBeginningsequence

Endingsequence

Page 13: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 13

Obtain C(x)Obtain C(x) Basic Idea: Select C(x) so that it is very unlikely to divide evenly into a

message with errors.

Frequently used C(X) in Table 2.5

Provable Results: - Single bit error detectable – the coefficients of the first and last term of C(x) are not 0. - Double bit error detectable – C(x) contain at least three 1 coefficients - Odd number of errors detectable - C(x) contains the factor (x+1) - Any “burst” (consecutive) error detectable – its length less than k

Page 14: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 14

CRC AlgorithmCRC Algorithm

Cost Effective

Efficient for Error Detection

Easy Implementation

Page 15: Error Detection Neil Tang 9/26/2008

CS440 Computer Networks 15

Error Detection Vs. Error CorrectionError Detection Vs. Error Correction

Error Correction is used only if

Errors happen frequently: wireless environment

The cost of retransmission is too high: satellite link, acoustic link.