Held Wednesday, March 1, 2000
Overview
Today we continue our consideration of the data-link layer by investigating
codes used for detecting and correcting errors at the data-link layer.
Notes
- There are likely to be some slots for second-year students on the
summer research team. You have until Friday to submit applications.
- I have not finished grading the homework. I apologize.
- I will not give an exam before break.
- Next week, you'll have a data-link programming simulation to work on.
I'll assign teams.
Contents
Summary
- Error-detecting codes
- Checksums
- CRC
- Error-correcting codes
- Sender/receiver issues
- How does the recipient know that the frame it received is correct?
- What kinds of errors can we get?
- Bits can flip
- Can bits be lost?
- Is it usally single bits or sequences of bits?
- The sender could send two copies. If they didn't match, the
recipient could assume they were incorrect.
- Of course, if the same bit is flipped in both copies, there's
no way to detect the error.
- There is also a lot of overhead, since we're sending two bits
for every bit of real information.
- A simple solution is to use a parity bit. Every n
bits, you count up the number of 1's and add a 1 or a 0 depending on
whether the count is even or odd.
- A single parity bit catches only one odd numbers of one-bit errors.
- In particular, it misses two one-bit errors.
- It may be helpful to use two-dimensional parity, in which
you arrange your data in a grid and compute parity for each row and
each column.
- This technique always catches three or few one-bit errors. (Proof?)
- It is also likely to catch more errors.
- A better technique is to use a cyclic redundancy check.
We treat the data as an n-degree polynomial.
- For example, 1001 is x3 + 1
- Similarly, 100100 is x5 + x2
- We choose a special k-degree polynomial for this technique.
- (The technique requires k check bits.)
- Smart mathematicians come up with those polynomials.
- The algorithm:
- Add k 0's to the end of the data.
- Divide by the special polynomial. The remainder will have
degree k-1 or less.
- Subtract the remainder from the extended data.
- The result is then divisible by the special polynomial.
- The recipient can divide what it receives by the special polynomial. If the
result is non-0, the data were corrupted.
- Since the remainder has k or fewer bits, the subtraction
does not affect the original n bits.
- This catches:
- Single-bit errors, provided the polynomial contains both
a degree-k term and degree -0 term.
- Any two one-bit errors, provided the polynomial contains at
least three terms.
- Any odd number of one-bit errors, as long as x+1 divides
the polynomial.
- Burst errors of less than k bits
- Can you explain why?
- Here are the most common CRC polynomials
- CRC-8: x8 +
x2 +
x1 +
1
- CRC-10: x10 +
x9 +
x5 +
x4 +
1
- CRC-12: x12 +
x11 +
x3 +
x2 +
1
- CRC-16: x16 +
x15 +
x2 +
1
- CRC-CCITT: x16 +
x12 +
x5 +
1
- What do we do once we've detected an error?
- Inform the sender to get another copy
- Hope that there's enough information to resolve the error.
- Peterson and Davie tell us that it's not worth the overhead for
error-correcting codes. However, it's worth spending a little
time on them.
- The most common error-correcting codes rely on what is called
the Hamming distance.
- The Hamming distance of two bit equal-length bit strings is
the number of bits you have to flip to convert one string to
the other.
- We'll draw a graph and a chart for three-bit strings.
- To correct one bit errors, we choose a set of strings such that
no two strings have a Hamming distance less than three
- Each represents some sequence of bits. If there are
four codes, we can represent pairs of bits.
- Convert from the sequence to the code.
- Send the code.
- Decode. If you don't have the original string, use the closest
one.
- Once we've detected an error, we must recover from that error.
- Hence, there must be some communication between sender and
received.
- Two basic techniques:
- The receiver can say ``Hey, I got that!''
- The receiver can say ``Hey, I missed something!''
- More tomorrow.