Presentation is loading. Please wait.

Presentation is loading. Please wait.

ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14.

Similar presentations


Presentation on theme: "ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14."— Presentation transcript:

1 ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14

2 ICOM 6115©Manuel Rodriguez-Martinez Lecture Objectives Understand the services provided by the Data Link Layer (Layer 2) –Error Detection and Correction Parity Bits CRC –Flow Control Stop-and-Wait Sliding Window

3 ICOM 6115©Manuel Rodriguez-Martinez What happens with Errors? Choices: –Detect the error and try to fix it Error-Correcting Codes –Detect the error but let some else try to fix it Error-Detecting Codes

4 ICOM 6115©Manuel Rodriguez-Martinez Error-Correcting Codes Add extra bits into the stream that can be used to repair the frame –Corrupted frame might be fixed from redundant bits Best known method: Hamming Codes –We will skip the details Good for noisy channels –Wireless links But, they are complex to implement

5 ICOM 6115©Manuel Rodriguez-Martinez Error Detecting Codes Used to determine if the frame got corrupted Need to ask for frame to be retransmitted Good for reliable channels –Probability of corruption is small –Deal with the occasional retransmission Much simpler to implement –Can have hardware to do it

6 ICOM 6115©Manuel Rodriguez-Martinez Two Dimensional Parity Bits Partition data in the frame (whole frame) into groups of 7-bits Compute the number of 1s in this group Add 1 or 0 to indicate paritiy –Even parity Add 1 – number of 1 bits is odd (make it even) Add 0 – number of 1 bits is already even –Odd parity Add 1 – number of 1 bits is even (make it odd) Add 0 – number of 1 bits is already

7 ICOM 6115©Manuel Rodriguez-Martinez Two dimensional Parity Bits Take all the 8-bit value from previous and compute parity across all bit positions Example: Even parity 01011101 00000100 11111101 01011010 Parity Bit Data

8 ICOM 6115©Manuel Rodriguez-Martinez Detecting the Error with Parity Bits Given a frame –for each byte do See if first 7-bit have yield parity consistent with parity bit –If not, error occurred And all bytes and make sure that it matches parity byte

9 ICOM 6115©Manuel Rodriguez-Martinez Checksum Checksum takes all bytes in a frame and adds each one of them to a number –1 complement arithmetic The resulting value is attached to the frame as a trailer The receiver gets the frame and checks that the sum of all bytes is equal to the checksum value

10 ICOM 6115©Manuel Rodriguez-Martinez Limitations of these schemes Two – dimensional parity bits –Can detect up to 4 bit errors Checksum –Cannot detect error that preserve the sum They are simple, but do not give you much

11 ICOM 6115©Manuel Rodriguez-Martinez CRC Cyclic Redundancy Check Based on the idea of polynomial multiplication and division Consider the bit pattern 10011010 –It can be interpreted as a polynomial X^7 + x^4 + x^3 + x –So, sender and receiver can be though of as exchanging polynomials –M(x) = 10011010 M(x) is the message to send

12 ICOM 6115©Manuel Rodriguez-Martinez CRC redundancy Idea is to take M(x) and add another part R(x) –M(x) is a message with n+1 bits, where n is the degree of M(x) –R(x) is a group of redundant bits, with a degree k Message actually sent is –P(x) = M(x)R(x) Concatenate R(x) to M(x)

13 ICOM 6115©Manuel Rodriguez-Martinez How do we reconstruct message? Sender and receiver must agree on polynomial C(x) to divide P(x) and get M(x) –C(x) is called the generator Receiver will divide P(x) with C(x) to get M(x) back This is polynomial long division –Subtraction many times –Bitwise, this is done as follows Multiplication – ANDs Substraction - XORs

14 ICOM 6115©Manuel Rodriguez-Martinez How do we build the message? Algorithm Input: M(x) – message, k – degree of C(x) –Multiply M(x) by x^k (append k zeroes to M(x)) Let this value be T(x) –Divide T(x) by C(x) and store remainder as R(x) R(x) = T(x) % C(x) –Substract R(x) from T(x) P(x) = T(x) XOR R(x) –This really attaches R(x) to T(x)

15 ICOM 6115©Manuel Rodriguez-Martinez Sample Polynomial Division M(x) = 10011010 C(x) = 1101

16 ICOM 6115©Manuel Rodriguez-Martinez Question: How to we pick C(x)? Well, people have spent years trying many ones –Just pick one, try and see how good it might be for your design Trial and error Some examples –CRC-8 = x^8 + x^2 + x + 1 –CRC-10 = x^10 + x^9 + x^5 + x^4 + x + 1 –CRC-16 = x^16 + x^15 + x^2 + 1

17 ICOM 6115©Manuel Rodriguez-Martinez Flow Control Problem –How can the sender reliably send frames to receiver without overrunning it? Key Issues –Reliably Make sure the frame gets there –Detect error –Possibly retransmit –Overrunning Make sure receiver has time to handle frames –Otherwise, frames will be lost causing retransmission

18 ICOM 6115©Manuel Rodriguez-Martinez Design Issues Need a way to mark frames –Sequence numbers –Allows receiver to keep track of has arrived and what is missing Need a way to acknowledge the receipt of a frame –ACK Must also be numbered Need a protocol to govern transmission and retransmission

19 ICOM 6115©Manuel Rodriguez-Martinez Frame Header TYPE – frame type (ACK or REGULAR) SEQNO – sequence number for the frame ACKNO – ACK number FLAGS – other control flags SNDR – address of sender RECV – address of receiver TYPESEQ NO ACK NO FLAGSSNDRRECV

20 ICOM 6115©Manuel Rodriguez-Martinez ARQ Algorithms Automatic Repeat Request (ARQ) Algorithms –Used to control flow of frames Based on these ideas –ACK Indicate receipt of packet –Timeout Indicate that an ACK for a packet X has not arrived –Forces retransmission

21 ICOM 6115©Manuel Rodriguez-Martinez Stop and Wait Sender send 1 frame at a time Waits for ACK from receiver Two modes –Simplex –Simplex with timeout


Download ppt "ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14."

Similar presentations


Ads by Google