You are on page 1of 10

Error detection/correction in computer networks

Examples:
computers in a network sharing data data moving between primary and secondary memory two computers linked via a modem signals sent from Mars probe

Why do we get errors?


transmission impairments signal gets attenuated, overwhelmed by noise

103-3

Objectives
How does noise affect data transmission? What kind of error detection/correction schemes are there?
parity checks vertical redundancy (VRC) longitudinal redundancy (LRC) checksum ISBN UPC Hamming codes Hamming distance sparse code property

What are their strengths and weaknesses?


what kind of errors can be handled?

What is forward error correction?


and what is the alternative?
103-4

Effect of noise on a digital signal


Data transmitted Signal 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0

Noise

Signal + noise

Sampling instants Received

0 1 0 1 1 0 1 1 1 0 0 1 0 0 0
103-5

Error detection vs correction


Error detection
introduce redundancy into the data stream e.g. send everything twice!

Error correction by coding (forward)


introduce enough redundancy to allow correction e.g. send everything three times!

Error correction by protocol


first detect errors then request retransmission
103-6

Parity check
7-bit ASCII codes (128 codes, see Appendix H) 8-bit ASCII
parity bit: odd parity or even parity (convention) ASCII A (65)
odd parity

1000001 11000001 01000001 01001001


parity error (A Q )
103-7

even parity

bit error

VRC: Vertical redundancy checking

Error correction with LRC


VRC (parity bit) detects single-bit errors Add LRC: Longitudinal redundancy checking LRC+VRC corrects all 1-bit errors detects all 1-bit, 2-bit, 3-bit errors (not 4-bit)
VRC

A (65) B (66) C (67) D (68)


LRC

0 0 1 0

1 1 1 1

0 0 0 0

0 0 0 0

0 0 0 0

0 0 0 1

0 1 1 0

1 0 1 0
1 1 0 1 1 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 0 1 0 1 0 103-8

1 0 0 0 0 1 0 0

even parity: always the same either way (not so with odd parity)

? 1 1 1 1 0 1 1

Checksum
Block of characters Add up their values Divide by 256, take remainder (one byte) Append to block
1. 2. 3. 128. A A A A

0 0 0 0

1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1 1 0 0 0 0 0 1

129 byte block

checksum

1 0 0 0 0 0 0 0

128 65 = 8320 = 25632 + 128


103-9

ISBN
Why do 10% of books have ISBNs ending in X?
Bronson: ISBN 0-534-36801-8
10 9 8 7 6 5 4 3 2 remainder on division by 11 if 0, then 0 else subtract from 11 if the result is 10, use X 179 3 8

Checksum: vulnerable to byte swap This is a positional checksum

103-10

UPC Universal Product Code


product type check digit
module width of 7 alternating bar and space width 1, 2, 3, 4 20 possible codes
0 1 2 3 4 5 6 7 8 9 left digits SBSB 3211 2221 2122 1411 1132 1231 1114 1312 1213 3112 right digits BS B S 321 1 222 1 212 2 141 1 113 2 123 1 111 4 131 2 121 3 311 2

guard bars

0 1 2 3 4 5

6 7 8 9 0 5

103-11

UPC checksum
0 1 2 3 4 5 6 7 8 9 0 5

odd sum 20 3

even sum 25

85

10 (85 % 10) = 5

103-12

Hamming codes
Error correction: transmit everything 3 times!

Two messages: code send A 0 000 B 1 111

100 000 110 010 011 001

101

111

103-13

Better Hamming codes


A B 2-letter alphabet (1 bit) 000 111 3-bit codes correct all 1-bit errors 3

A B C D 4-letter alphabet (2 bits)

00000 11100 ? ? 5-bit codes correct all 1-bit errors 2.5


103-14

Better Hamming codes


Alphabet
2 letters (1 bit)

Codes
3 bits

Redundancy
3 A B A B C D 000 111 00000 11100 ? ?

4 letters (2 bits)

5 bits

2.5

16 letters (4 bits) 256 letters (8 bits)

7 bits 12 bits

1.75 1.5

These codes all correct single-bit errors

103-15

Mariner: Mars reconnaissance vehicles


In July and August 1969 two space probesMariner 6 and Mariner 7flew by Mars to gather data and return images of Earths neighbouring planet. Their five-month voyages provided a wealth of new information about Mars, 60 million miles away. The data came in the form of 140 television images taken at distances from 1.1 million down to 93,000 miles as the craft approached the planet and another 58 high-resolution pictures taken as close to the surface as 2,100 miles. In addition the Mariners made infrared and ultraviolet measurements and were aimed to pass behind the planet to determine how radio signals from the craft would be affected by the planets atmosphere. Because Mars rotated more than five times while being photographed, virtually every feature seen through earth-based telescopes was recorded and can be studied in pictures providing a resolution as much as 10 times better than that obtainable from the earth. For about 10 percent of the planet the new pictures provide a resolution about 100 times better than pictures from the earth, and for selected areas within this 10 percent the close-ups have a resolution about 1,000 times better.
103-16

Mariner: Mars reconnaissance vehicles


01011010010110100101101001011010
sev e in ral m utes

01001010000101100111101101111010 5 bit pixels


0 white 1 2 grey 30 31 black

32 bit codes
Transmit 6 copies of each 5-bit pixel 6 5 = 30 bits Majority vote Can only correct 2 errors!

103-17

Code used by Mariner


0 1 2 5

can correct all errors up to 7 bits

every pair of rows differs in exactly 16 places (Hamming distance)

30 31

5 01011010010110100101101001011010
103-18

Error correction using protocol


To correct errors, detect and retransmit
Sender: 1. 2. 3. 4. Compute error check (LRC, checksum) Append to data block Send block of data (packet) Wait
00000010 00010101

Receiver:

1. Receive the packet 2. Check for errors 3. If no error, send ACK (ASCII 6) else send NAK (ASCII 21) 1. If receive NAK, resend the packet 2. If receive ACK, send next packet 3. If receive anything else, ignore it

Sender:

What if NAK gets corrupted or lost? (time out and re-send) or ACK? (number packets) or sender and receiver lose sync? (number ACKs) or lockstep sync causes too much delay? (several un-ACKd packets) 103-19 or you need a bidirectional channel? (ha!study computer science)

Richard Hamming
Born: 11 Feb 1915 in Chicago, Illinois, USA Died: 7 Jan 1998 in Monterey, California, USA
Richard Hamming earned the Ph.D. at the University of Illinois in 1942, then joined the Manhattan Project in New Mexico. There, he learned how to operate the Projects computers and helped physicists complete calculations necessary for the design of the atomic bomb. After the war, Hamming joined other young mathematicians at Bell Telephone Laboratories. He continued his work with computers. Frustrated by the unreliability of early machines, he devised a method for the detection and correction of errors in digital data. After leaving Bell Labs, he built a second career as a teacher and author of textbooks at the Naval Postgraduate School. He spoke highly of his students. He believed that invention and discovery would quickly outdate the factual content of his courses and so gave priority to helping his students learn how to learn. He liked to quote Louis Pasteur, saying that luck favors the prepared mind. Richard Hamming died on January 7, 1998 at the age of 82 years. He is survived by Wanda, his wife of 55 years who also contributed to the Manhattan Project at 103-20 Los Alamos, New Mexico.

Questions
1. Whats forward error correction? What is the other kind of error correction? 2. Whats the difference between even parity and odd parity? 3. Whats the difference between vertical redundancy checking and longitudinal redundancy checking? 4. If you use a vertical redundancy check together with a longitudinal redundancy check, how many bit errors can be corrected? How many can be detected? 5. How do you compute the checksum of a message? 6. Devise a 3-bit code for a 2-letter alphabet that corrects all 1-bit errors. 7. Devise a 5-bit code for a 4-letter alphabet that corrects all 1-bit errors. 8. What is the basic idea of error correction by protocol? 9. Whats an ACK? Whats a NACK? 10. Why do error correction protocols usually number the packets?
103-21

10

You might also like