Flow control and Error control ECS 152A Xin Liu Based on Kurose and Ross.

Slides:



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

EIE325: Telecommunication TechnologiesMaciej J. Ogorza ł ek, PolyU, EIE Telecommunication Technologies Week 8 Flow Control Error Control.
William Stallings Data and Computer Communications 7th Edition
Data and Computer Communications Updated: 2/9/2009.
Chapter 6 Errors, Error Detection, and Error Control.
5-1 Link Layer: Introduction Some terminology: r hosts and routers are nodes r communication channels that connect adjacent nodes along communication path.
Chapter 7 – Data Link Control Protocols
PART III DATA LINK LAYER. Position of the Data-Link Layer.
15 – Data link layer Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction.
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 12 Introduction to Computer Networks.
Data Link Control Protocols Data link control protocol Provides a layer of control between systems on a transmission medium referred to as data link. DLC.
1 Data Link Layer Lesson 6 NETS2150/ Position of the data-link layer McGraw-Hill © The McGraw-Hill Companies, Inc., 2004.
5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross.
1 ITC242 – Introduction to Data Communications Week 10 Topic 16 Data link control.
William Stallings Data and Computer Communications 7 th Edition Chapter 7 Data Link Control Protocols.
Review r The Internet (IP) Protocol m Datagram format m IP fragmentation m ICMP: Internet Control Message Protocol m NAT: Network Address Translation r.
1 K. Salah Module 4.0: Data Link Layer The Logical Link Control (LLC) sublayer –Framing –Flow Control –Error Control The Media Access Control (MAC) sublayer.
Review r Multicast Routing m Three options m source-based tree: one tree per source shortest path trees reverse path forwarding m group-shared tree: group.
Chapter 5 Link Layer slides are modified from J. Kurose & K. Ross CPE 400 / 600 Computer Communication Networks Lecture 20.
5: DataLink Layer5-1 Link Layer – Error Detection/Correction and MAC.
William Stallings Data and Computer Communications 7 th Edition (Selected slides used for lectures at Bina Nusantara University) Error Control.
Semester Copyright USM EEE442 Computer Networks The Data Link / Network Layer Functions: Flow Control and Error Control En. Mohd Nazri Mahmud.
3-1 Transport services and protocols r provide logical communication between app processes running on different hosts r transport protocols run in end.
EE 4272Spring, 2003 Chapter 7 Data Link Control Objectives: Effective & reliable data communication between two directly connected transmitting-receiving.
3-1 Last time □ Finished introduction and overview: ♦ Network access and physical media ♦ Internet structure and ISPs ♦ Delay & loss in packet-switched.
Introduction 1 Lecture 23 Link Layer (Error Detection/Correction) slides are modified from J. Kurose & K. Ross University of Nevada – Reno Computer Science.
5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Part 1: Overview of the Data Link layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose,
Data and Computer Communications Eighth & Ninth Edition by William Stallings Chapter 7 – Data Link Control Protocols.
Data Link Control Protocols
Data Communications and Networking
Data Link Control Protocols Dr. Muazzam A. Khan. Flow Control Ensuring the sending entity does not overwhelm the receiving entity —Preventing buffer overflow.
Aegis School of Telecommunication Chapter 7 Data Link Control Protocols Telecom Systems I by Dr. M. G. Sharma, Phd.
William Stallings Data and Computer Communications 7th Edition
1 Data Link Layer Lecture 20 Imran Ahmed University of Management & Technology.
PART III DATA LINK LAYER. Position of the Data-Link Layer.
4: DataLink Layer1 Chapter 4: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m sharing.
Lecture 3-2: Coding and Error Control (Cont.) ECE
Chapter 5 Link Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 A note on the use of these.
5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross.
5: DataLink Layer5-1 Error Detection EDC= Error Detection and Correction bits (redundancy) D = Data protected by error checking, may include header fields.
Chapter 5 Link Layer Computer Networking: A Top Down Approach 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012 Link Layer introduction,
5: DataLink Layer5-1 Link Layer r 5.1 Introduction and services r 5.2 Error detection and correction r 5.3Multiple access protocols r 5.4 Link-Layer Addressing.
1 Week 5 Lecture 3 Data Link Layer. 2 Data Link Layer location application: supporting network applications –FTP, SMTP, STTP transport: host-host data.
11/25/20151 EEC-484 Computer Networks Lecture 12 Wenbing Zhao Cleveland State University
Data Link and Flow Control Networks and Protocols Prepared by: TGK First Prepared on: Last Modified on: Quality checked by: Copyright 2009 Asia Pacific.
Eighth Edition by William Stallings Chapter 7 – Data Link Control Protocols Data Link Control Protocols need layer of logic above Physical to manage exchange.
CIS : Data Link Control. Flow Control Ensuring the sending entity does not overwhelm the receiving entity —Preventing buffer overflow Transmission.
5: DataLink Layer5-1 Chapter 5 Link Layer and LANs A note on the use of these ppt slides: We’re making these slides freely available to all (faculty, students,
EEC-484/584 Computer Networks
Prof. Younghee Lee 1 1 Computer Networks u Lecture 5: Transport services and protocols Prof. Younghee Lee * Some part of this teaching materials are prepared.
5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross.
5: DataLink Layer5a-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction.
Shashank Srivastava Motilal Nehru national Institute Of Information Technology, Allahabad Data Link Layer.
Transmission Errors Error Detection and Correction.
5: DataLink Layer5-1 Chapter 5: The Data Link Layer Our goals: r understand principles behind data link layer services: m error detection, correction m.
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.
5: DataLink Layer5-1 Chapter 5 Link Layer and LANs Computer Networking: A Top Down Approach Featuring the Internet, 3 rd edition. Jim Kurose, Keith Ross.
Data and Computer Communications Data Link Control Protocols.
CPSC 441: Link Layer1 Link Layer Addressing Slides originally from Carey Williamson Notes derived from “ Computer Networking: A Top Down Approach”, by.
CS 457 – Lecture 3 Link Layer Protocols Fall 2011.
William Stallings Data and Computer Communications Chapter 7 Data Link Control.
Chapter 5 Link Layer A note on the use of these ppt slides:
Data Link Control Protocols  need layer of logic above Physical  to manage exchange of data over a link frame synchronization frame synchronization flow.
Coding and Error Control
The Data Link Layer Supplementery Slides
Chap. 4 Data link layer 2.
Data Link Layer What does it do?
Link Layer and LANs Its not about how hard you hit... It's about how hard you can get hit and keep moving forward 5: DataLink Layer.
Data Link Layer: Overview; Error Detection
William Stallings Data and Computer Communications
Presentation transcript:

Flow control and Error control ECS 152A Xin Liu Based on Kurose and Ross

The Data Link Layer Our goals: r understand principles behind data link layer services: m Flow control m error detection, correction m reliable data transfer

Link Layer: Introduction Some terminology: r hosts and routers are nodes r communication channels that connect adjacent nodes along communication path are links m wired links m wireless links m LANs r layer-2 packet is a frame, encapsulates datagram “link” data-link layer has responsibility of transferring datagram from one node to adjacent node over a link

Link layer: context r Datagram transferred by different link protocols over different links: m e.g., Ethernet on first link, frame relay on intermediate links, on last link r Each link protocol provides different services m e.g., may or may not provide rdt over link transportation analogy r trip from Princeton to Lausanne m limo: Princeton to JFK m plane: JFK to Geneva m train: Geneva to Lausanne r tourist = datagram r transport segment = communication link r transportation mode = link layer protocol r travel agent = routing algorithm

Link Layer Services r Framing, link access: m encapsulate datagram into frame, adding header, trailer m channel access if shared medium m “MAC” addresses used in frame headers to identify source, dest different from IP address! r Reliable delivery between adjacent nodes m we learned how to do this already (chapter 3)! m seldom used on low bit error link (fiber, some twisted pair) m wireless links: high error rates Q: why both link-level and end-end reliability?

Link Layer Services (more) r Flow Control: m pacing between adjacent sending and receiving nodes r Error Detection: m errors caused by signal attenuation, noise. m receiver detects presence of errors: signals sender for retransmission or drops frame r Error Correction: m receiver identifies and corrects bit error(s) without resorting to retransmission r Half-duplex and full-duplex m with half duplex, nodes at both ends of link can transmit, but not at same time

Adaptors Communicating r link layer implemented in “adaptor” (aka NIC) m Ethernet card, PCMCI card, card r sending side: m encapsulates datagram in a frame m adds error checking bits, rdt, flow control, etc. r receiving side m looks for errors, rdt, flow control, etc m extracts datagram, passes to rcving node r adapter is semi- autonomous r link & physical layers sending node frame rcving node datagram frame adapter link layer protocol

Flow Control r Ensuring the sending entity does not overwhelm the receiving entity m Preventing buffer overflow r Transmission time m Time taken to emit all bits into medium r Propagation time m Time for a bit to traverse the link

Model of Frame Transmission

Stop and Wait r Source transmits frame r Destination receives frame and replies with acknowledgement r Source waits for ACK before sending next frame r Destination can stop flow by not send ACK r Works well for a few large frames

Fragmentation r Large block of data may be split into small frames m Limited buffer size m Errors detected sooner (when whole frame received) m On error, retransmission of smaller frames is needed m Prevents one station occupying medium for long periods r Stop and wait becomes inadequate

Stop and Wait Link Utilization

Sliding Windows Flow Control r Allow multiple frames to be in transit r Receiver has buffer W long r Transmitter can send up to W frames without ACK r Each frame is numbered r ACK includes number of next frame expected r Sequence number bounded by size of field (k) m Frames are numbered modulo 2 k

Sliding Window Diagram

Example Sliding Window

Sliding Window Enhancements r Receiver can acknowledge frames without permitting further transmission (Receive Not Ready) r Must send a normal acknowledge to resume r If duplex, use piggybacking m If no data to send, use acknowledgement frame m If data but no acknowledgement to send, send last acknowledgement number again, or have ACK valid flag (TCP) Q: if the size of field is k, what is the maximum window size? A: 2^k -1. Assuming 0,1,…2^k-1 (2^k window size) sent out, need to ack the last 2^k-1.

Error Detection and correction

Error Detection 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

Parity Checking Single Bit Parity: Detect single bit errors Two Dimensional Bit Parity: Detect and correct single bit errors 0 0

UDP checksum Sender: r treat segment contents as sequence of 16-bit integers r checksum: addition (1’s complement sum) of segment contents r sender puts checksum value into UDP checksum field Receiver: r compute checksum of received segment r check if computed checksum equals checksum field value: m NO - error detected m YES - no error detected. But maybe errors nonetheless? More later …. Goal: detect “errors” (e.g., flipped bits) in transmitted segment

Internet Checksum Example r Note m When adding numbers, a carryout from the most significant bit needs to be added to the result r Example: add two 16-bit integers wraparound sum checksum

Cyclic Redundancy Check r view data bits, D, as a binary number r choose r+1 bit pattern (generator), G r goal: choose r CRC bits, R, such that m exactly divisible by G (modulo 2) m receiver knows G, divides by G. If non-zero remainder: error detected! m can detect all burst errors less than r+1 bits r widely used in practice (ATM, HDCL)

CRC Example Want: D. 2 r XOR R = nG equivalently: D. 2 r = nG XOR R equivalently: if we divide D. 2 r by G, want remainder R R = remainder[ ] D.2rGD.2rG

Cyclic Redundancy Check r For a block of k bits transmitter generates n bit sequence r Transmit k+n bits which is exactly divisible by some number r Receive divides frame by that number m If no remainder, assume no error

Addition: Multiplication: Division: x 3 + x + 1 ) x 6 + x 5 x 3 + x 2 + x x 6 + x 4 + x 3 x 5 + x 4 + x 3 x 5 + x 3 + x 2 x 4 + x 2 x 4 + x 2 + x x = q(x) quotient = r(x) remainder divisor dividend 35 ) Figure 3.55 Cyclic Redunancy check

Steps: 1) Multiply i(x) by x n-k (puts zeros in (n-k) low order positions) 2) Divide x n-k i(x) by g(x) 3) Add remainder r(x) to x n-k i(x) (puts check bits in the n-k low order positions): quotientremainder transmitted codeword b(x) = x n-k i(x) + r(x) x n-k i(x) = g(x) q(x) + r(x) Cyclic Redundancy Check

Generator polynomial: g(x)= x 3 + x + 1 Information: (1,1,0,0) i(x) = x 3 + x 2 Encoding: x 3 i(x) = x 6 + x ) x 3 + x + 1 ) x 6 + x 5 x 3 + x 2 + x x 6 + x 4 + x 3 x 5 + x 4 + x 3 x 5 + x 3 + x 2 x 4 + x 2 x 4 + x 2 + x x Transmitted codeword: b(x) = x 6 + x 5 + x b = (1,1,0,0,0,1,0)

Capability of CRC r An error E(X) is undetectable if it is divisible by P(x). The following can be detected. m All single-bit errors if P(x) has more than one nonzero term m All double-bit errors if P(x) has a factor with three terms m Any odd number of errors, if P(x) contain a factor x+1 m Any burst with length less or equal to n-k m A fraction of error burst of length n-k+1; the fraction is 1-2^(-(-n-k-1)). m A fraction of error burst of length greater than n-k+1; the fraction is 1-2^(-(n-k)). r Powerful error detection; more computation complexity compared to Internet checksum

Error Correction r Correction of detected errors usually requires data block to be retransmitted Not appropriate for wireless applications m Bit error rate is high Lots of retransmissions m Propagation delay can be long (satellite) compared with frame transmission time Would result in retransmission of frame in error plus many subsequent frames r Need to correct errors on basis of bits received r Basic idea: redundancy

Error Correction r Hamming distance: d(v1,v2) between two n-bit binary sequences v1 and v2 is the # of bits in which v1 and v2 disagree. r (n,k) block code: map each k-bit sequence into a unique n-bit codeword (n>k). r K=2,n=5 Datacode Consider one bit of error, say > d(00000,00001)=1; d(00111,00001)=2; d(11001,00001)=2; d(11110,00001)=4;

Error Control r Detection and correction of errors r Lost frames r Damaged frames r Automatic repeat request m Error detection m Positive acknowledgement m Retransmission after timeout m Negative acknowledgement

Automatic Repeat Request (ARQ) r Stop and wait r Go back N r Selective reject (selective retransmission)

Stop and Wait r Source transmits single frame r Wait for ACK r If received frame damaged, discard it m Transmitter has timeout m If no ACK within timeout, retransmit r If ACK damaged,transmitter will not recognize it m Transmitter will retransmit m Receive gets two copies of frame m Use ACK0 and ACK1

Stop and Wait - Diagram

Stop and Wait - Pros and Cons r Simple r Inefficient

Go Back N (1) r Based on sliding window r If no error, ACK as usual with next frame expected r Use window to control number of outstanding frames r If error, reply with rejection m Discard that frame and all future frames until error frame received correctly m Transmitter must go back and retransmit that frame and all subsequent frames

Go Back N - Damaged Frame r Receiver detects error in frame i r Receiver sends rejection-i r Transmitter gets rejection-i r Transmitter retransmits frame i and all subsequent

Go Back N - Lost Frame (1) r Frame i lost r Transmitter sends i+1 r Receiver gets frame i+1 out of sequence r Receiver send reject i r Transmitter goes back to frame i and retransmits

Go Back N - Lost Frame (2) r Frame i lost and no additional frame sent r Receiver gets nothing and returns neither acknowledgement nor rejection r Transmitter times out and sends acknowledgement frame with P bit set to 1 r Receiver interprets this as command which it acknowledges with the number of the next frame it expects (frame i ) r Transmitter then retransmits frame i

Go Back N - Damaged Acknowledgement r Receiver gets frame i and send acknowledgement (i+1) which is lost r Acknowledgements are cumulative, so next acknowledgement (i+n) may arrive before transmitter times out on frame i r If transmitter times out, it sends acknowledgement with P bit set as before r This can be repeated a number of times before a reset procedure is initiated

Go Back N - Damaged Rejection r As for lost frame (2)

Go Back N - Diagram

Selective Repeat r receiver individually acknowledges all correctly received pkts m buffers pkts, as needed, for eventual in-order delivery to upper layer r sender only resends pkts for which ACK not received m sender timer for each unACKed pkt r sender window m N consecutive seq #’s m again limits seq #s of sent, unACKed pkts

Selective repeat: sender, receiver windows

Selective repeat data from above : r if next available seq # in window, send pkt timeout(n): r resend pkt n, restart timer ACK(n) in [sendbase,sendbase+N]: r mark pkt n as received r if n smallest unACKed pkt, advance window base to next unACKed seq # sender pkt n in [rcvbase, rcvbase+N-1] r send ACK(n) r out-of-order: buffer r in-order: deliver (also deliver buffered, in-order pkts), advance window to next not-yet-received pkt pkt n in [rcvbase-N,rcvbase-1] r ACK(n) otherwise: r ignore receiver

Selective repeat in action

Selective repeat: dilemma Example: r seq #’s: 0, 1, 2, 3 r window size=3 r receiver sees no difference in two scenarios! r incorrectly passes duplicate data as new in (a) Q: what relationship between seq # size and window size?