You are on page 1of 49

Error Control

Feedback: Using special control frames. To ensure reliable delivery is to provide the sender with some feedback.
Data Frame

Sender

Acknowledgement (ACK) Or negative Acknowledgement (NAK)

Receiver

Timers : Hardware troubles may cause special control frames to vanish completely and the receiver will not react at all. Sequence Numbers : To outgoing frames, to prevent receiver from accepting the same frame two or more times, and pass it to the network layer more than once. To help receiver distinguish retransmissions from originals.

EDC= Error Detection and Correction bits (redundancy) D = Data protected by error checking, may include header fields Error detection not 100% reliable! protocol may miss some errors, but rarely larger EDC field yields better detection and correction

Transmission errors : generated by physical processes, errors on some media tend to come in bursts rather than singly. Disadvantage: They are much harder to detect and correct than isolated errors. Advantage: Isolated Errors : every packet would be in error

bursty error: only one packet is incorrect

Error-Correcting Codes What is a codeword ? m data bits r check bits

n=m+r There are 2n possible codewords and 2m possible data messages. Hamming distance between codewords: min d(C1,C2)=number of (same bit position) bits which differ d(10010010,00010001)=3 If two codewords are a hamming distance d apart, it will require d single-bit errors to convert one into the other.

In most data transmission applications, all 2m possible data messages are legal, but due to the way the check bits are computed, not all 2n possible codewords are used. Given the algorithm for computing the check bits, it is possible to construct a complete list of codewords, and from this list find the two codewords whose Hamming distance is minimum. This distance is the Hamming distance of the complete code.

To detect d errors, you need a distance d+1 code.

radius=d bits distance<d+1 distance d+1

To correct d errors, you need a distance 2d+1 code.

<2d+1

radius=d bits

2d+1

Parity check is a code with distance 2. Therefore, it can detect single-bit error. Consider a code with only 4 valid codewords: 0000000000, 0000011111, 1111100000, 1111111111 This code has a distance of 5, which means that it can detect 4 bit errors and correct double errors. If the codeword 0000000111 arrives and we know at most two bits are in error, the receiver knows that the original must have been 0000011111. If, however, a triple error changes 0000000000 into 0000000111, the error will not be corrected properly.

A 1-bit error correcting code (Hamming code) m data bits r check bits

n=m+r Each of the 2m legal messages has n illegal codewords at a distance 1 from it. Thus each of the 2m legal messages requires n+1 bit patterns dedicated to it. Therefore, ( n + 1)2 m 2 n

( m + r + 1)2 m 2 m+ r ( m + r + 1) 2 r

Single Bit Parity:


Detect single bit errors

Two Dimensional Bit Parity:


Detect and correct single bit errors

There is a lower limit on the number of check bits needed to correct single errors. In practice, it can be achieved using a method due to Hamming. The bits of codewords are numbered consecutively, starting with bit 1 at the left end. The bits that are power of 2 (1, 2, 4, 8, ) are check bits. The rest are filled up with the data bits. Each check bit forces the parity of some collection of bits, including itself, to be even (or odd).

Error-Correcting Codes A 1-bit error correcting code (Hamming code)

Correct 12-bit burst errors by transmitting vertically.

Error-Correcting Codes A 1-bit error correcting code (Hamming code)

b1 b3 b5 b7 b9 b11 = 1 b2 b3 b7 b10 b11 = 1 b4 b5 b6 b7 = 1 b8 b10 b11 = 1


When a codeword arrives, the receiver initializes a counter to zero. It then examines each check bit, k, to see if it has the correct parity. If not, it adds k to the counter. If the counter is zero afterwards, the codeword is accepted as valid. If the counter is nozero, it contains the number of the incorrect bit.

Error-detecting Codes
error control: error detection or error correction? assume error rate=1/106 data=1000 bits error detecting check bits: 1 bit (e.g. parity check) error correcting check bits: 10 bits (e.g. Hamming code) retransmission In 103 packets: error detecting overhead=103+1001=2001 bits error correcting overhead=10*103 bits=10000 bits

The Data Link Layer


Error-detecting Codes CRC (Cyclic Redundancy Code) Treat bit strings as polynomials with coefficient 0 and 1. (E.g. 10001001:x7+x3+1, 01010111=x6+x4+x2+x+1) 1. Sender and receiver agree upon a polynomial of degree r. (the generating polynomial, G(x)) 2. M (x) x r Assume = A( x ) with remainder R ( x ). G( x ) Then transmit T ( x ) = M ( x ) x r R ( x ). 3. When receiver receives T(x), it divides it by G(x). If there is a remainder, then an error has occurred. (All the above operations are done in modulo 2.)

Elementary Data Link Protocols

Elementary Data Link Protocols

Elementary Data Link Protocols

1. An Unrestricted Simplex Protocol

2. A Simplex Stop-and-Wait Protocol

3. A Simplex Protocol for Noisy Channel sequence numbers (to number packets and ACKs) P(1) P(2) time-out P(1) P(1) error receiver ACK new receiver ACK old

sender

sender

If there is no sequence number for packets, the receiver can not distinguish between these two cases.
4 4

A potential failure The sender cannot tell whether this ACK is for P(1) or P(2) if not numbered. sender time-out P(1) P(2) P(1) error receiver ACK ACK ACKs must also be numbered.
4 5

3. A Simplex Protocol for Noisy Channel Protocols in which the sender waits for a positive acknowledgement before advancing to the next data item are often called PAR (Positive Acknowledgement with Retransmission) or ARQ (Automatic Repeat reQuest).

Although it can handle lost frames by timing out, it requires the timeout interval to be long enough to prevent premature timeouts. If the sender times out early, while the acknowledgement is still on the way, it will send a duplicate.

3. A Simplex Protocol for Noisy Channel

You might also like