Presentation is loading. Please wait.

Presentation is loading. Please wait.

EEC-484/584 Computer Networks Lecture 8 Wenbing Zhao (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and.

Similar presentations


Presentation on theme: "EEC-484/584 Computer Networks Lecture 8 Wenbing Zhao (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and."— Presentation transcript:

1 EEC-484/584 Computer Networks Lecture 8 Wenbing Zhao wenbing@ieee.org (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and Prentice-Hall)

2 2 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Outline Error detection and correction Elementary Data Link Protocols Example protocols (not required for quiz)

3 3 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Error-Correcting Codes n-bit codeword – an n-bit unit containing data and check bits –m bits of data, r bits redundant/check bits (n = m+r) How to measure the differences between two codewords (num of different bits) –Using exclusive OR and counting number of 1 bits in the result

4 4 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Error-Correcting Codes Hamming distance – number of bit positions in which two codewords differ If two codewords are a Hamming distance d apart, it will require d single-bit errors to convert one into the other

5 5 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Error-Correcting Codes Complete code –Complete list of all legal codewords: 2 m possible data messages –Recall that there are m bits of data Hamming distance of the complete code –Find two codewords whose Hamming distance is minimum

6 6 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Error-Detection Codes A distance d+1 code can detect up to d errors, why? –If there are d+1 errors, one valid codeword might be turned into another valid codeword –≤ d errors will change a valid codeword into an illegal codeword  can be detected!

7 7 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Error-Correcting Codes To correct d errors, need a distance 2d+1 code –Legal codewords are so far part that even with d changes, original codeword is still closer than any other codeword, so it can be uniquely determined

8 8 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Error-Correcting Codes: Example Consider a code with only four valid codewords –0000000000, 0000011111, 1111100000, 1111111111 This code has a distance 5  can correct double errors –If 0000000111 arrives, receiver knows the original must have been 0000011111 –However, if triple error changes 0000000000 to 0000000111, the error will not be corrected properly

9 9 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Parity Bit Parity bit – a single bit is appended to the data Parity bit is chosen so that number of 1 bits in the codeword is even or odd Example: Given 1011010 –With even parity  10110100 –With odd parity  10110101 A code with a single parity bit has a distance 2 –Since any single-bit error produces a codeword with wrong parity  can be used to detect single bit errors

10 10 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Error-Detecting Codes: CRC Polynomial code, also known as CRC (Cyclic Redundant Code) Treat bit string as polynomial with 0 and 1 coefficients m-bit frame: M(x) = b m-1 x m-1 + … + b 0 E.g.: 11011010 => M(x) = x 7 + x 6 + x 4 + x 3 + x 1 Use modulo 2 arithmetic –No carries or borrows: XOR

11 11 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Cyclic Redundant Code Sender and receiver agree on generator polynomial G(x) (High & low order bits must be 1) For a frame with m bits corresponding to M(x), m > deg G(x) = r Append checksum to end of frame so polynomial T(x) corresponding to checksummed frame is divisible by G(x) When receiver gets checksummed frame, divides T(x) by G(x) If remainder R(x) != 0, then transmission error

12 12 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Algorithm to Compute CRC Checksum Let m = deg M(x), r = deg G(x) Append r 0 bits to lower-order end of frame: x r M(x) Divide bit string corresponding to x r M(x) by bit string corresponding to G(x) Subtract remainder R(x) from bit string corresponding to x r M(x), result is checksummed frame. Let T(x) be its polynomial –x r M(x) = Q(x)G(x) + R(x) –x r M(x) – R(x) = Q(x)G(x) = T(x)

13 13 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Compute CRC Checksum XOR

14 14 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao International Standard Polynomials CRC-12 G(x) = x 12 + x 11 + x 3 + x 2 + x 1 + 1 –Used for 6-bit characters CRC-16 G(x) = x 16 + x 15 + x 2 + 1 CRC-CCITTG(x) = x 16 + x 12 + x 5 + 1 –Used for 8-bit characters CRC-32G(x) = x 32 + x 26 + x 23 + x 22 + x 16 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x 1 + 1 –Used in IEEE 802 –Detects all bursts of length 32 or less and all bursts affecting an odd number of bits

15 15 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Exercise Given 1011011, calculate the parity bit to be appended to the bit string –If even parity is used –If odd parity is used –If the highest order bit is inverted to 0, show how the error can be detected

16 16 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Exercise To provide more reliability than a single parity bit can give, an error-detecting coding scheme uses one parity bit for checking all the odd-numbered bits and a second parity bit for all the even- numbered bits. What is the Hamming distance of this code?

17 17 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Exercise A bit stream 10011101 is transmitted using the standard CRC method described in the text. The generator polynomial is x 3 + 1. Show the actual bit string transmitted. Suppose the third bit from the left is inverted during transmission. Show that this error is detected at the receiver's end.

18 18 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Elementary Data Link Protocols An Unrestricted Simplex Protocol A Simplex Stop-and-Wait Protocol A Simplex Protocol for a Noisy Channel

19 19 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Initial Assumptions Physical, data link, network layers are independent processes Sender has infinite amount of data ready to send, supplied by network layer “ wire-like ” service: DLL provides reliable, source ordered delivery service to NL Packet from NL is treated as pure data When sender accepts packet from NL, it encapsulates in a frame with a header and trailer

20 20 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Initial Assumptions Receiver waits for arrived of frame, which generates an interrupt When frame arrives at receiver, hardware computes checksum –If error then DLL informed event = chksum_err –Else DLL informed event = frame_arrival DLL acquires frame from physical layer, checks control info in header If ok then passes packet to NL

21 21 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Protocol Definitions Continued 

22 22 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Protocol Definitions

23 23 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Protocol Definitions

24 24 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Unrestricted Simplex Protocol Additional assumptions –Processing time insignificant –Infinite buffer space –Communication channel never loses or damages frames Uses no sequence numbers or acks –Only event type frame_arrival

25 25 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Unrestricted Simplex Protocol

26 26 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Unrestricted Simplex Protocol

27 27 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Stop-and-Wait Protocol Drop assumption –Receiver processing time insignificant, or, equivalently, infinite input buffer at receiver Main problem –To prevent sender from overwhelming the receiver If receiver takes t time units to execute from physical layer to network layer, sender must not transmit more than one frame per time t

28 28 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Stop-and-Wait Protocol One solution – too conservative –Restrict sender so transmits so slowly that even if frame undergoes max delay no buffer overflows Better solution –Receiver provides feedback to sender and gives sender permission to send next frame Sender sends frame, stop and wait for ack Alternates between sender and receiver –Half-duplex

29 29 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Stop-and-Wait Protocol

30 30 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Stop-and-Wait Protocol

31 31 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Drop assumption –Frames not damaged or lost Assumption –If frame is damaged, receiver will detect it when it computes the checksum Possible solution –Receiver sends acknowledgement if receives uncorrupted frame, discards frame if damaged –Sender sends frame again if doesn ’ t receive acknowledgement before timeout Simplex Protocol for Noisy Channel

32 32 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Protocol for Noisy Channel Problem: duplicate messages –Receiver receives uncorrupted frame, sends acknowledgement –Sender times out before receiving acknowledgement, sends frame again –Receiver receives second copy uncorrupted – has duplicate copies Solution –Use sequence numbers: 1 bit suffices

33 33 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Protocol for Noisy Channel How to determine timeout value –Timeout must be long enough so sender does not send duplicate when ack is on its way –Timeout must allow Frame to get to receiver Receiver to process frame Ack to get to sender

34 34 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Protocol for Noisy Channel Acks need to be matched against frames –Sender remembers next_frame_to_send –Receiver remembers frame_expected Positive Acknowledgement with Retransmission (PAR), or, Automatic Repeat reQuest (ARQ) –Sender waits for a positive acknowledgement before advancing to the next data item

35 35 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Protocol for Noisy Channel Continued 

36 36 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Protocol for Noisy Channel send3() (cont’d)

37 37 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Protocol for Noisy Channel Continued 

38 38 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Simplex Protocol for Noisy Channel send3() (cont’d)

39 39 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Example Data Link Protocols High-Level Data Link Control PPP Included for completeness, not required for quiz

40 40 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao High-Level Data Link Control Bit oriented, using bit-stuffing Address Control – used for sequence numbers, acks, and other purposes Data – may contain any info. May be arbitrarily long Checksum – cyclic redundancy code Flag – 01111110 Types of frames: information, supervisory, unnumbered

41 41 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao HDLC Information Frame Uses a sliding window with a 3-bit sequence number –Seq – sequence number –Next – piggybacked ack –P/F – Poll/Final

42 42 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Point-to-Point Protocol A framing method (using byte stuffing) LCP (link control protocol) – for bringing lines up, testing them, negotiating options and bringing them down again NCP (network control protocol) – to negotiate network-layer options in a way that is independent of the network layer protocol to be used

43 43 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao PPP Frame format – resembles HDLC frame format Major difference – byte stuffing, character oriented Does not provide reliable transmission using sequence numbers and acks as the default Connection oriented service might not guarantee reliability!

44 44 Spring Semester 2006EEC-484/584: Computer NetworksWenbing Zhao Error-Detecting Codes If a single parity bit is appended to a block, error detecting probability is only 0.5 if burst error occurs (why?) This can be improved by treating a block as a matrix, n bits wide and k bits high, –A parity bit is computed for each column and affixed to the matrix as the last row –The matrix is transmitted one row at a time –Probability of accepting bad block is 2 -n


Download ppt "EEC-484/584 Computer Networks Lecture 8 Wenbing Zhao (Part of the slides are based on materials supplied by Dr. Louise Moser at UCSB and."

Similar presentations


Ads by Google