Error Detection Neil Tang 9/26/2008 CS440 Computer Networks
Outline Basic Idea Objectives Two-Dimensional Parity Checksum Algorithm Cyclic Redundancy Check (CRC) CS440 Computer Networks
Basic 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. CS440 Computer Networks
Basic 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. CS440 Computer Networks
Objectives Maximize the probability of detecting errors. Minimize the number of redundant bits. CS440 Computer Networks
Two-Dimensional Parity It can catch 1-, 2-, 3- and most 4-bits errors. Why? 14 redundant bits for 42-bit message. Good enough? CS440 Computer Networks
Checksum 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 CS440 Computer Networks
Checksum 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 CS440 Computer Networks
CRC (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. CS440 Computer Networks
Polynomial 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 CS440 Computer Networks
Algorithm to Obtain CRC Multiply M(x) by xk , i.e., attach k 0s at the end of the message. Call this 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) 1101 11111001 10011010000 Message T(x) 1001 1000 1011 1100 101 Remainder CS440 Computer Networks
CRC 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. CS440 Computer Networks
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 CS440 Computer Networks
CRC Algorithm Cost Effective Efficient for Error Detection Easy Implementation CS440 Computer Networks
Error 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. CS440 Computer Networks