5 Error Detection
5 Error Detection
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
103-3
Objectives
How does noise affect data transmission?
1
Effect of noise on a digital signal
Data transmitted 0 1 0 1 1 0 0 1 1 0 0 1 0 1 0
Signal
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
introduce redundancy into the data stream
e.g. send everything twice!
103-6
2
Parity check
7-bit ASCII codes (128 codes, see Appendix H)
→ 8-bit ASCII
ASCII A 1000001
(65)
A (65) 0 1 0 0 0 0 0 1
B (66) 0 1 0 0 0 0 1 0
C (67) 1 1 0 0 0 0 1 1
D (68) 0 1 0 0 0 1 0 0
LRC 1 0 0 0 0 1 0 0
1 1 0 0 0 0 0 1
1 1 0 0 0 0 1 0
even parity: always the same either way 0 1 0 0 0 0 1 1
1 1 0 0 0 1 0 0
(not so with odd parity) ? 1 1 1 1 0 1 1 103-8
3
Checksum
Block of characters
Add up their values
Divide by 256, take remainder (one byte)
Append to block
1. A 0 1 0 0 0 0 0 1
2. A 0 1 0 0 0 0 0 1
3. A 0 1 0 0 0 0 0 1
129
… … byte
block
128. A 0 1 0 0 0 0 0 1
checksum 1 0 0 0 0 0 0 0
ISBN
×10 ×9 ×8 ×7 ×6 ×5 ×4 ×3 ×2 179
remainder on division by 11 3
if 0, then 0
else subtract from 11 8
if the result is 10, use X
4
UPC — Universal Product Code
product check module width of 7
left digits right digits
SBSB BS B S
type digit alternating bar 0 3211 321 1
1 2221 222 1
and space 2 2122 212 2
width 1, 2, 3, 4 3 1411 141 1
4 1132 113 2
20 possible codes 5 1231 123 1
6 1114 111 4
7 1312 131 2
8 1213 121 3
9 3112 311 2
0 1 2 3 4 5 6 7 8 9 0 5
guard bars 103-11
UPC checksum
0 1 2 3 4 5 6 7 8 9 0 5
85 10 – (85 % 10) = 5
103-12
5
Hamming codes
Error correction: transmit everything 3 times!
010 011
103-13
A 00000
B 11100
C ?
D ?
6
Better Hamming codes
103-16
7
Mariner: Mars reconnaissance vehicles
01011010010110100101101001011010
in utes
e ral m
sev
01001010000101100111101101111010
30
31
5
01011010010110100101101001011010 103-18
8
Error correction using protocol
To correct errors, detect and retransmit
Sender: 1. Compute error check (LRC, checksum)
2. Append to data block
3. Send block of data (“packet”)
4. Wait
Receiver: 1. Receive the packet
2. Check for errors 00000010
3. If no error, send ACK (ASCII 6)
else send NAK (ASCII 21) 00010101
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 Project’s 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
Los Alamos, New Mexico. 103-20
9
Questions
1. What’s “forward error correction”? What is the other kind of error
correction?
2. What’s the difference between even parity and odd parity?
3. What’s 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. What’s an ACK? What’s a NACK?
10. Why do error correction protocols usually number the packets?
103-21
10