T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429/556 Introduction to Computer Networks Reliability Some slides used with permissions.

Slides:



Advertisements
Similar presentations
EE 4272Spring, 2003 Chapter 7 Data Link Control Objectives: Effective & reliable data communication between two directly connected transmitting-receiving.
Advertisements

10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Introduction to Information Technologies
CSE 461: Error Detection and Correction. Next Topic  Error detection and correction  Focus: How do we detect and correct messages that are garbled during.
Reliability & Channel Coding
Chapter 6 Errors, Error Detection, and Error Control.
Spring 2002CS 4611 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
Chapter Six Errors, Error Detection, and Error Control Data Communications and Computer Networks: A Business User’s Approach Sixth Edition.
1 Chapter Six - Errors, Error Detection, and Error Control Chapter Six.
PART III DATA LINK LAYER. Position of the Data-Link Layer.
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 12 Introduction to Computer Networks.
The Data Link Layer Chapter 3. Position of the data-link layer.
EE 122: Error detection and reliable transmission Ion Stoica September 16, 2002.
1 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
1 ITC242 – Introduction to Data Communications Week 10 Topic 16 Data link control.
Chapter 2 : Direct Link Networks (Continued). So far... Modulation and Encoding Link layer protocols Error Detection -- Parity Check.
Spring 2003CS 4611 Outline Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
Chapter 6 Errors, Error Detection, and Error Control
20101 The Data Link Layer Chapter Design Issues Controls communication between 2 machines directly connected by “wire”-like link Services Provided.
Error Detection and Correction
Adapted from Tanenbaum's Slides for Computer Networking, 4e The Data Link Layer Chapter 3.
Error Detection and Reliable Transmission EECS 122: Lecture 24 Department of Electrical Engineering and Computer Sciences University of California Berkeley.
18-Aug-154/598N: Computer Networks Overview Direct link networks –Error detection - Section 2.4 –Reliable transmission - Section 2.5.
Go-Back-N ARQ  packets transmitted continuously (when available) without waiting for ACK, up to N outstanding, unACK’ed packets  a logically different.
1 Data Link Layer Lecture 20 Imran Ahmed University of Management & Technology.
PART III DATA LINK LAYER. Position of the Data-Link Layer.
Lecture 7: Reliable Packet Transmission. Cyclic Redundancy Check Add k bits of extra data (the CRC field) to an n-bit message to provide error detection.
Error Coding Transmission process may introduce errors into a message.  Single bit errors versus burst errors Detection:  Requires a convention that.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14.
Lecture 6: Framing and Error Detection-Data Link Layer Functions
27-Oct-15Computer Networks1 Outline Chapter 2: Direct Link Networks Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
Fall 2000Datacom 11 Outline Hardware Building Blocks Encoding Framing Error Detection Sliding Window Algorithm Point-to-Point Links.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Data Link Layer PART III.
1 Chapter Six - Errors, Error Detection, and Error Control Chapter Six.
Error Detection and Correction
Data Communications & Computer Networks, Second Edition1 Chapter 6 Errors, Error Detection, and Error Control.
Link Layer Dr. Mozafar Bag-Mohammadi Ilam University.
Computer Science Division
T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429 Introduction to Computer Networks Lecture 12: Reliability Slides used with permissions.
T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429/556 Introduction to Computer Networks Principles of Congestion Control Some slides.
Computer Communication & Networks Lecture 9 Datalink Layer: Error Detection Waleed Ejaz
CHAPTER 3: DATA LINK CONTROL Flow control, Error detection – two dimensional parity checks, Internet checksum, CRC, Error control, Transmission efficiency.
Error Detection.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2000 PART III: DATA LINK LAYER ERROR DETECTION AND CORRECTION 7.1 Chapter 10.
Transmission Errors Error Detection and Correction.
10.1 Chapter 10 Error Detection and Correction Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Network Layer4-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing.
Computer Networking Lecture 16 – Reliable Transport.
Simple Parity Check The simplest form of error detection is the parity check used with ASCII codes, originally on asynchronous modem links Each 7 bit ASCII.
Introduction to Information Technologies
Data Link Layer.
Part III. Data Link Layer
Advanced Computer Networks
CIS 321 Data Communications & Networking
Part III Datalink Layer 10.
COMP/ELEC 429/556 Introduction to Computer Networks
Packetizing Error Detection
Packetizing Error Detection
Reliable transmission
Point-to-Point Links Outline Encoding Framing Error Detection
Introduction to Information Technologies
Error Detection Neil Tang 9/26/2008
Packetizing Error Detection
Dr. Mozafar Bag-Mohammadi Ilam University
Error detection: Outline
EECS 122: EE122: Error Detection and Reliable Transmission
Data Link Layer. Position of the data-link layer.
Presentation transcript:

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University1 COMP/ELEC 429/556 Introduction to Computer Networks Reliability Some slides used with permissions from Edward W. Knightly, T. S. Eugene Ng, Ion Stoica, Hui Zhang

Know What You Know? T. S. Eugene Ngeugeneng at cs.rice.edu Rice University2 Host Houston Host Chicago B

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University3

4 Overview Goal: Reliably transmit packets Packets can get lost –Routing loop, network congestion Bits can get corrupted –Interference, noise Solution –Detect loss or corruption –Recover Who’s responsibility is it? Switches, routers or end hosts?

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University5 Retransmission-Based Recovery Retransmit lost or corrupted packets –Packets are uniquely identified by sequence numbers –Correctly received packets are acknowledged –Packets not acknowledged are retransmitted Do this efficiently –Use available bandwidth efficiently –Detect loss/corruption and retransmit quickly

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University6 Naïve Approach: Stop-and-Wait Send DATA packet; wait for acknowledgement (ACK); repeat If timeout, retransmit DATA packet ACK DATA Time Sender Receiver Transmission time RTT Round-Trip-Time or Round-Trip Propagation Delay Transmission time of ACK

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University7 DATA Loss DATA Time Sender Receiver Timeout Trans. Time Lost or Corrupted

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University8 ACK DATA Time Sender Receiver Trans. Time Lost or Corrupted ACK Loss Timeout

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University9 How Many Sequence Numbers Needed for Stop-and-Wait? 2; need a 1 bit sequence number (i.e. alternate between 0 and 1) to distinguish duplicate packets timeout DATA ACK

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University10 Problem with Stop-and-Wait Lots of time wasted in waiting for acknowledgements What if you have a 10Gbps link, a data packet size of 1500B (like Ethernet), ACK size of 40B and a propagation delay of 10ms? Because you send one packet and wait –Throughput = 1500*8bit/(2*10ms + (1500B+40B)/10Gbps) ~= 600Kbps! –A utilization of 0.006%

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University11 window = set of adjacent sequence numbers The size of the set is the window size (denote it n) Let A be the last ack’d packet seq # of sender without gap; then window of sender = {A+1, A+2, …, A+n} Sender can send a packet as soon as it is inside its window Let B be the last received packet seq # without gap by receiver; then window of receiver = {B+1,…, B+n} Receiver can accept out of sequence packets if in window Better Approach: Sliding Window …… A

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University12 Sender Sliding Window Example …… ✔✔✔✔ Ack’d: ✔ Packets whose sequence number within sliding window, can be sent out Packets whose sequence number outside sliding window, cannot be sent out If receive ACK for packet that falls outside of sliding window, ignore such ACK

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University13 Sender Sliding Window Example …… ✔✔✔✔ Ack’d: ✔ ✔✔✔

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University14 Sender Sliding Window Example …… ✔✔✔✔ Ack’d: ✔ ✔✔

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University15 Receiver Sliding Window Example …… ✔✔✔✔ Received: ✔ ✔✔✔ packet outside of sliding window, must reject packet ?

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University16 Basic Timeout and Acknowledgement Every packet k transmitted is associated with a timeout Basic acknowledgement scheme –Receiver sends ack for packet k+1 when all packets with sequence numbers <= k have been received –An ack k+1 means every packet up to k has been received –Suppose packets B, C, D have been received, but receiver is still waiting for A. No ack is sent when receiving B,C,D. But as soon as A arrives, an ack for D+1 is sent by the receiver, and the receiver window slides If by timeout(k), ack for k+1 has not yet been received, the sender retransmits packet k …… ABCD

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University17 Example with Loss Time Window size = 3 packets SenderReceiver Timeout Packet 5 5

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University18 Packets within Sender Window Can Be Sent Time Window size n = 9

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University19 Efficiency Time n = 9, i.e. 9 packets in one RTT Can fully use available bandwidth if n is large enough RTT

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University20 How Many Unique Sequence Numbers Needed? Time n unique sequence numbers not enough to differentiate the retransmission of a packet in current window and a new transmission from the next window Retransmitted Original ACK lost Need 2*n unique sequence numbers

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University21 Observations With sliding windows, it is possible to fully utilize a link, provided the window size is large enough Throughput proportional to (n/RTT) –Stop & Wait is like n = 1 But how to figure out the right window size to use??? –A key question addressed in the “Congestion Control” module Sender has to buffer all unacknowledged packets, because they may require retransmission Receiver may accept out-of-order packets within window, and delay delivery to application until the missing in-order packets are received

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University22 Setting Timers The sender needs to set retransmission timers in order to know when to retransmit a packet that may have been lost How long to set the timer for? –Too short: may retransmit before data or ACK has arrived, creating duplicates –Too long: if a packet is lost, will take a long time to recover (inefficient)

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University23 Timing Illustration 1 1 Timeout too long  inefficiency 1 1 Timeout too short  duplicate packets RTT Timeout RTT

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University24 Adaptive Timers The amount of time the sender should wait is related to the round-trip time (RTT) between the sender and receiver RTT not known a priori and may change, so a protocol must adapt E.g. TCP timeouts are adaptive, will discuss later in the course

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University25 Error Detection: Naïve Approach Send a message twice Compare two copies at the receiver –If different, some errors exist How many bits of error can you detect? What is the overhead?

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University26 Error Detection Problem: detect bit errors in packets Solution: add extra bits to each packet Goals: –Small overhead, i.e., small number of redundancy bits –Large number of bit error patterns that can be detected

What is the Relationship between the red bit and the black bits? T. S. Eugene Ngeugeneng at cs.rice.edu Rice University27 e.g e.g e.g e.g e.g e.g

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University28 Parity – Illustrates Idea Behind Error Detection Even parity –Add a parity bit to 7 bits of data to make an even number of 1’s How many bits of error can be detected by a parity bit? What’s the overhead?

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University29 Two-dimensional Parity Add one extra bit to a 7-bit code such that the number of 1’s in the resulting 8 bits is even (for even parity, and odd for odd parity) Add a parity byte for the packet Example: five 7-bit character packet, even parity

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University30 How Many Errors Can you Detect? All 1-bit errors Example: error bit odd number of 1’s

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University31 How Many Errors Can you Detect? All 2-bit errors Example: error bits odd number of 1’s on columns

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University32 How Many Errors Can you Detect? All 3-bit errors Example: error bits odd number of 1’s on column

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University33 How Many Errors Can you Detect? Example of 4-bit error that is not detected: error bits

Error Detection in Network Protocols Parity is used in PCI buses, cache/memory, etc. Parity is seldom used in network protocols Ethernet (datalink layer) uses cyclic redundancy check IP (network layer) uses 1’s complement sum TCP (transport layer) uses 1’s complement sum T. S. Eugene Ngeugeneng at cs.rice.edu Rice University34

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University35 Cyclic Redundancy Check (CRC)

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University36 Arithmetic Modulo 2 Like binary arithmetic but without borrowing/carrying from/to adjacent bits Examples: Addition and subtraction in binary arithmetic modulo 2 is equivalent to XOR aba b

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University37 Some Polynomial Arithmetic Modulo 2 Properties Subtracting/adding C(x) from/to B(x) modulo 2 is equivalent to performing an XOR on each pair of matching coefficients of C(x) and B(x) –E.g.: B(x) = x 7 + x 5 + x 3 + x 2 + x 0 ( ) C(x) = x 3 + x 1 + x 0 ( ) B(x) - C(x) = x 7 + x 5 + x 2 + x 1 ( )

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University38 Cyclic Redundancy Check (CRC) Represent a n-bit message as an (n-1) degree polynomial M(x) –E.g.,  M(x) = x 7 + x 5 + x 3 + x 2 + x 0 Choose a divisor k-degree polynomial C(x) Compute remainder R(x) of M(x)*x k / C(x), i.e., M(x)*x k = A(x)*C(x) + R(x), where degree(R(x)) < k Let T(x) = M(x)*x k – R(x) = A(x)*C(x) Then –T(x) is divisible by C(x) –First n coefficients of T(x) represent M(x)

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University39 Cyclic Redundancy Check (CRC) Sender: –Compute and send T(x), i.e., the coefficients of T(x) Receiver: –Let T’(x) be the (n-1+k)-degree polynomial generated from the received message –If C(x) divides T’(x)  assume no errors; otherwise errors Note: all computations are modulo 2

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University40 Example (Sender Operation) Send packet ; choose C(x) = 101 –k = 2, M(x)*x K  Compute the remainder R(x) of M(x)*x k / C(x) Compute T(x) = M(x)*x k - R(x)  xor 1 = Send T(x) 101) R(x)

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University41 Example (Receiver Operation) Assume T’(x) = –C(x) divides T’(x)  no errors Assume T’(x) = –Remainder R’(x) = 1  error! 101) R’(x) Note: an error is not detected iff C(x) divides T’(x) – T(x)

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University42 CRC Properties Detect all single-bit errors if coefficients of x k and x 0 of C(x) are one Detect all double-bit errors, if C(x) has a factor with at least three terms Detect all number of odd errors, if C(x) contains factor (x+1) Detect all burst of errors smaller than k bits See Peterson & Davie Table 2.5 for some commonly used CRC polynomials

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University43 IP/TCP 1’s Complement Checksum Sender: add all words of data and append the result (checksum) to the data Receiver: add all words of received data and compare the result with the checksum

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University44 1’s Complement Number Representation Negative number –x is x with all bits inverted When two numbers are added, the carry-on is added to the result Example: ; assume 8-bit representation 15 =  -15 = = = 1

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University45 IP and TCP Checksum Implementation u_short cksum(u_short *buf, int count) { register u_long sum = 0; while (count--) { sum += *buf++; if (sum & 0xFFFF0000) { /* carry occurred, so wrap around */ sum &= 0xFFFF; sum++; } return ~(sum & 0xFFFF); }

T. S. Eugene Ngeugeneng at cs.rice.edu Rice University46 Properties How many bits of error can IP and TCP checksum detect? What’s the overhead? Why use this algorithm? –Link layer typically has stronger error detection (Ethernet uses CRC) –Most Internet protocol processing in the early days (70’s 80’s) was done in software with slow CPUs, argued for a simple algorithm –Seems to be OK in practice What about the end-to-end argument?