You are on page 1of 49

.

.

.

.

.

.

.

.

and pass it to the network layer more than once. to prevent receiver from accepting the same frame two or more times. To help receiver distinguish retransmissions from originals. Sequence Numbers : To outgoing frames.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. .

.

but rarely • larger EDC field yields better detection and correction h o t e r w s i e . may include header fields • Error detection not 100% reliable! • protocol may miss some errors.EDC= Error Detection and Correction bits (redundancy) D = Data protected by error checking.

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 .Transmission errors : generated by physical processes.

• • .

Hamming distance between codewords: min d(C1.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.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. .

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

radius=d bits distance<d+1 distance ≥ d+1 .To detect d errors. you need a distance d+1 code.

<2d+1 radius=d bits ≥2d+1 . you need a distance 2d+1 code.To correct d errors.

1111100000. If. Consider a code with only 4 valid codewords: 0000000000. the error will not be corrected properly. a triple error changes 0000000000 into 0000000111. Therefore.Parity check is a code with distance 2. however. . 0000011111. 1111111111 This code has a distance of 5. it can detect single-bit error. 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.

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 0 0 .

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

.Error-Correcting Codes A 1-bit error correcting code (Hamming code) Correct 12-bit burst errors by transmitting vertically.

It then examines each check bit. . If the counter is zero afterwards. k. If the counter is nozero. If not. to see if it has the correct parity. it adds k to the counter. it contains the number of the incorrect bit. the receiver initializes a counter to zero.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 codeword is accepted as valid.

g.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. Hamming code) retransmission In 103 packets: error detecting overhead=103+1001=2001 bits error correcting overhead=10*103 bits=10000 bits .

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

.

.

Elementary Data Link Protocols .

Elementary Data Link Protocols .

Elementary Data Link Protocols .

.

.

.

1. An Unrestricted Simplex Protocol .

.

.

2. A Simplex Stop-and-Wait Protocol 4 1 .

4 2 .

4 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.3. the receiver can not distinguish between these two cases. 4 4 .

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

it requires the timeout interval to be long enough to prevent premature timeouts. while the acknowledgement is still on the way. 4 6 . 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 will send a duplicate. If the sender times out early.3.

A Simplex Protocol for Noisy Channel 4 7 .3.

4 8 .

4 9 .