Chapter 4 Data Link Layer

Slides:



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

William Stallings Data and Computer Communications 7th Edition
C) All rights reserved by Professor Wen-Tsuen Chen1 Chapter 3 The Data link Layer ä For reliable, efficient communication between two adjacent machines.
Go-Back-N Improve Stop-and-Wait by not waiting!
Data and Computer Communications Updated: 2/9/2009.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Chapter 11 Data Link Control and Protocols.
Department of Electronic Engineering City University of Hong Kong EE3900 Computer Networks Data Link Control Slide 1 Data Link Control Chapter 7.
ELEN 602 Lecture 5 Review of last lecture –Error Detection -- parity/CRC etc. Automatic Retransmission Request (ARQ) Reading: Chap
11-6 HDLC High-level Data Link Control (HDLC) is a bit-oriented protocol for communication over point-to-point and multipoint links. It implements the.
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.
11-6 HDLC High-level Data Link Control (HDLC) is a bit-oriented protocol for communication over point-to-point and multipoint links. It implements the.
The Data Link Layer Chapter 3. Position of the data-link layer.
The OSI Reference Model
Chapter 9: Data Link Control Business Data Communications, 4e.
20101 The Data Link Layer Chapter Design Issues Controls communication between 2 machines directly connected by “wire”-like link Services Provided.
Adapted from Tanenbaum's Slides for Computer Networking, 4e The Data Link Layer Chapter 3.
Example Data Link Protocols Quick review Reference Models? Layers? Flow Control? Bit stuffing? Connection Oriented? Synchronous transmission?
HDLC and PPP. The Data Link Layer in the Internet A home personal computer acting as an internet host. Technology like Ethernet cannot provide “high-level”
Chapter 5 Peer-to-Peer Protocols and Data Link Layer PART II: Data Link Controls Framing Point-to-Point Protocol High-Level Data Link Control.
1 Application Layer Presentation Layer Session Layer Transport Layer Network Layer Data Link Layer Physical Layer Application Layer Presentation Layer.
Data and Computer Communications Eighth & Ninth Edition by William Stallings Chapter 7 – Data Link Control Protocols.
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.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Chapter 11 Data Link Control Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction.
William Stallings Data and Computer Communications 7th Edition
Data and Computer Communications Tenth Edition by William Stallings Data and Computer Communications, Tenth Edition by William Stallings, (c) Pearson Education.
1 CSE3213 Computer Network I Service Model, Error Control, Flow Control, and Link Sharing (Ch. 5.1 – and 5.7.1) Course page:
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Data Link Layer Part I – Designing Issues and Elementary.
McGraw-Hill©The McGraw-Hill Companies, Inc., 2004 Data Link Control and Protocols.
Leon-Garcia & Widjaja: Communication Networks Copyright ©2000 The McGraw Hill Companies Chapter 5 Leon-Garcia Peer-to-Peer Protocols We will cover most.
Chapter 3 THE DATA LINK LAYER
Chapt 3 Data Link Layer1 Data Link Layer Functions –Provides services to network layer Well-defined interface –Framing –Flow control – between adjacent.
Chapter 5 Peer-to-Peer Protocols and Data Link Layer PART I: Peer-to-Peer Protocols ARQ Protocols and Reliable Data Transfer Flow Control.
THE DATA LINK LAYER Chapter 3 1. H YBRID M ODEL The hybrid reference model to be used in this book. 2.
The Data Link Layer Goal –As reliable as possible, efficient communication Point-to-Point –single connection –bits arrive in order sent Not necessarily.
The Data Link Layer. Functions of the Data Link Layer Provide service interface to the network layer Dealing with transmission errors Error detection.
The Data Link Layer. Functions of the Data Link Layer Provide service interface to the network layer Frame delineation Dealing with transmission errors.
Computer Networks Module 3: Data Link Layer (Framing) Dr. Vikram Shete St. Francis Institute of Technology.
1 Application Layer Presentation Layer Session Layer Transport Layer Network Layer Data Link Layer Physical Layer Application Layer Presentation Layer.
CS3505: DATA LINK LAYER. data link layer  phys. layer subject to errors; not reliable; and only moves information as bits, which alone are not meaningful.
Chapter 11 Data Link Control
Data Link Layer: Data Link Control : Data Communication and Computer Networks Asst. Prof. Chaiporn Jaikaeo, Ph.D.
CHAPTER 3: DATA LINK CONTROL Flow control, Error detection – two dimensional parity checks, Internet checksum, CRC, Error control, Transmission efficiency.
CIS : Data Link Control. Flow Control Ensuring the sending entity does not overwhelm the receiving entity —Preventing buffer overflow Transmission.
1 Reliable stream service--TCP 1.TCP accepts byte stream, segments 2.It is over IP, so out-of-sequence is very common --lost or error frame results in.
Data Link Layer Flow and Error Control. Flow Control Flow Control Flow Control Specifies the amount of data can be transmitted by sender before receiving.
10.1 UNIT - IV Error Detection and Correction Data can be corrupted during transmission. Some applications require that errors be detected and corrected.
Transmission Errors Error Detection and Correction.
COSC 3213: Computer Networks I Instructor: Dr. Amir Asif Department of Computer Science York University Section M Topics: 1.Flow Control and ARQ Protocols.
1 Flow&Error Control R. Supakorn. 2 Flow Control Flow control refers to a set of procedure used to restrict the amount of data that the sender can send.
Data Link Layer. Link Layer The data unit to be transmited at the link layer is called a frame. Why link layer? How can it know where a frame begins and.
Data and Computer Communications Data Link Control Protocols.
1 The Data Link Layer A. S. Tanenbaum Computer Networks W. Stallings Data and Computer Communications Chapter 3.
11.1 Chapter 11 Data Link Control Copyright © The McGraw-Hill Companies, Inc. Permission required for reproduction or display.
Chapter 9: Data Link Control Business Data Communications, 4e.
Data and Computer Communications Data Link Control Protocols.
Data Communications Data Link Layer.
Powerpoint Templates Data Communication Muhammad Waseem Iqbal Lec # 15.
1 Wireless Networks Lecture 5 Error Detecting and Correcting Techniques (Part II) Dr. Ghalib A. Shah.
Chapter 3 The Data Link Layer.
HDLC and PPP.
Chapter 9: Data Link Control
Data Link Layer What does it do?
CIS 321 Data Communications & Networking
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
Chapter 5 Peer-to-Peer Protocols and Data Link Layer
Lecture 4 Peer-to-Peer Protocols and Data Link Layer
Chapter 9: Data Link Control
Data Link Layer. Position of the data-link layer.
Presentation transcript:

Chapter 4 Data Link Layer Framing Error control Flow control Multiplexing Link Maintenance Security

Services Transfers frames across direct connections Directly connected (can be wireless), wire-like Losses & errors, but no out-of-sequence frames More detailed services Framing (bits ↔ frames) Error control (protection from impairment) Flow control Multiplexing Link Maintenance Security: Authentication & Encryption

Data Link Protocols Examples PPP HDLC Ethernet LAN layer Physical A B Packets Frames Examples PPP HDLC Ethernet LAN IEEE 802.11 (WiFi) LAN

Framing (Chapter 5.4 in Leon-Garcia)

Framing Bit stream - frames Frame boundaries can be determined using: Character Counts Control Characters Framing Bits Framing by illegal code 0110110111 Framing received frames 0111110101 transmitted

Control Characters Data to be sent A DLE B ETX STX E Transmission of printable characters using ASCII Octets with HEX value < 0x20 are nonprintable Use control characters: STX (start of text) = 0x02; ETX (end of text) = 0x03. Data to be sent A DLE B ETX STX E After stuffing and framing DLE B ETX STX A E What about transmission of data (including non-printable characters)? Introduce DLE (data link escape) = 0x10 DLE STX (DLE ETX) used to indicate beginning (end) of frame Insert extra DLE in front of occurrence of DLE STX (DLE ETX) in frame All DLEs occur in pairs except at frame boundaries.

Bit Stuffing Frame delineated by flag character Address Control Information FCS HDLC frame any number of bits Frame delineated by flag character HDLC uses bit stuffing to prevent occurrence of flag 01111110 inside the frame Transmitter inserts extra 0 after each consecutive five 1s inside the frame Receiver checks for five consecutive 1s if next bit = 0, it is removed if next two bits are 10, then flag is detected If next two bits are 11, then frame has errors

Example: Bit stuffing 0110111111111100 Data to be sent After stuffing and framing 0111111001101111101111100001111110 (a) *000111011111-11111-110* Data received After destuffing and deframing 01111110000111011111011111011001111110 (b)

Example: Framing in Ethernet Ethernet complies to standard IEEE 802.3 An illegal manchester coding is used for framing. A character count is also included in the header. All frames have an integral number of bytes. If not, the frame is considered to be received in error.

Error Control Coding (Chapter 3.9 in Leon-Garcia)

Error Control Two approaches Forward error correction (FEC) Error detection & retransmission (ARQ) Add redundancy (admit only codewords with a certain pattern) Blindspot: when channel transforms a codeword into another codeword (n,k) block code There are capacity-achieving codes Usually with somewhat high complexity; When bandwidth is abundant it suffices to use simpler codes. Channel Encoder b1…bk Decoder c1…cn

Single Parity Check All codewords have even # of 1s n=k+1 Information bits: b1, b2, b3, …, bk Check Bit: bk+1= b1+ b2+ b3+ …+ bk modulo 2 Codeword: (b1, b2, b3, …, bk,, bk+!) All codewords have even # of 1s All error patterns that change an odd number of bits are detectable Others undetectable Redundancy: overhead = 1/(k + 1)

Example Information (7 bits): (0, 1, 0, 1, 1, 0, 0)

P[undetectable error] = 0.0014 Probability of Error P[error detection failure] = P[undetectable error pattern] = P[all error patterns with even number of 1s] = p2(1 – p)n-2 + p4(1 – p)n-4 + … n 2 n 4 Example: Evaluate above for n = 6, p = 0.01 P[undetectable error] = 0.0014

Two-Dimensional Parity Check 1 0 0 1 0 0 0 1 0 0 0 1 1 1 0 1 1 0 1 0 0 1 1 1 column check bit row check bits

Error-detecting capability 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 0 1 0 1 0 0 1 1 1 0 0 0 0 0 1 1 0 0 1 1 0 1 1 0 1 1 0 Arrows indicate failed check bits Two errors One error Three errors Four errors (undetectable) 1, 2, or 3 errors can always be detected; Not all patterns >4 errors can be detected

Hamming Codes Class of linear block codes Capable of correcting all single-error patterns For each m > 2, there is a (2m–1, n-m) Hamming code m n = 2m–1 k = n–m Code rate k/n 3 7 4 4/7 15 11 11/15 5 31 26 26/31

m = 3 Hamming Code Information bits are b1, b2, b3, b4 Parity checks (binary addition/multiplication) b5 = b1 + b3 + b4 b6 = b1 + b2 + b4 b7 = + b2 + b3 + b4 Linearity 24 = 16 codewords

Hamming (7,4) code Information Codeword Weight b1 b2 b3 b4 b1 b2 b3 b4 b5 b6 b7 w(b) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 4 0 0 1 0 0 0 1 0 1 0 1 3 0 0 1 1 0 0 1 1 0 1 0 0 1 0 0 0 1 0 0 0 1 1 0 1 0 1 0 1 0 1 1 0 0 0 1 1 0 0 1 1 0 1 1 0 0 1 1 1 0 1 1 1 0 0 1 1 0 0 0 1 0 0 0 1 1 0 1 0 0 1 1 0 0 1 0 0 1 1 0 1 0 1 0 1 0 0 1 1 1 0 1 1 1 0 1 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 1 1 0 1 1 1 0 1 0 1 0 1 1 1 0 1 1 1 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 7

Parity Check Equations Rearrange parity check equations: 0 = b1 + b3 + b4 + b5 0 = b1 + b2 + b4 + b6 0 = + b2 + b3 + b4 + b7 In matrix form: b1 b2 0 = 1 0 1 1 1 0 0 b3 0 = 1 1 0 1 0 1 0 b4 = H bt = 0 0 = 0 1 1 1 0 0 1 b5 b6 b7 All codewords must satisfy these equations Note: each nonzero 3-tuple appears once as a column in check matrix H

Hamming Code: Error Detection 1 s = H e = = Single error detected s = H e = = + = Double error detected 1 0 1 1 1 0 0 1 1 0 1 0 1 0 0 1 1 1 0 0 1 s = H e = = + + = 0 Triple error not detected

Minimum distance Undetectable error pattern must have 3 or more bits At least 3 bits must be changed to convert one codeword into another codeword b1 b2 o Set of n-tuples within distance 1 of b1 Set of n-tuples within distance 1 of b2 Distance 3 Spheres of distance 1 around each codeword do not overlap If a single error occurs, the resulting n-tuple will be in a unique sphere around the original codeword

General Hamming Codes For m > 2, the Hamming code is obtained through the check matrix H: Each nonzero m-tuple appears once as a column The resulting code corrects all single errors P[undetectable error] = P[ error is a codeword] ≈ (# of codewords with dmin) x pdmin Animated example http://www.systems.caltech.edu/EE/Faculty/rjm/SAMPLE_20040708.html

Hamming Codes: Error-correction b e R + (Receiver) (Transmitter) Error pattern Compute syndrome: s = HR = H (b + e) = Hb + He = He If s = 0, then the receiver accepts R as the transmitted codeword, find the corresponding k-bit message If s is nonzero, then an error is detected Hamming decoder assumes a single error has occurred Each single-bit error pattern has a unique syndrome The receiver matches the syndrome to a single-bit error pattern and corrects the appropriate bit

Hamming Codes: Performance Assume bit errors occur independent of each other and with probability p s = H R = He s = 0 No errors in transmission Undetectable errors Correctable Uncorrectable (1–p)7 7p3 1–3p 3p 7p 7p(1–3p) 21p2

Other Error Control Codes Good practical codes for error detection: Internet Check Sums CRC Polynomial Codes They can detect the vast majority of errors. Good codes for error “correction”: Turbo codes Low-density parity-check (LDPC) codes

Internet Checksum Several Internet protocols (e.g. IP, TCP, UDP) use check bits to detect errors in the header A checksum is calculated for header contents and included in a special field. Treating each 16-bit word in data as an integer, find x = b0 + b1 + b2+ ...+ bL-1 modulo 216-1 The checksum is then given by: bL = - x modulo 216-1 Thus, the headers satisfy the following pattern: 0 = b0 + b1 + b2+ ...+ bL-1 + bL modulo 216-1

Polynomial Codes Convenient mathematical formulation of coding Polynomials as codewords Implemented using shift-register circuits Called cyclic redundancy check (CRC) codes Excellent for detecting burst errors Reg 0 + Encoder for g(x) = x3 + x + 1 Reg 1 Reg 2 0,0,0,i0,i1,i2,i3 g0 = 1 g1 = 1 g3 = 1

Automatic Repeat Request (ARQ) (Chapter 5 in Leon-Garcia)

Peer-to-Peer Protocols Each layer provides a service to the layer above. It does so by executing a peer-to-peer protocol. The protocol uses the the services of the layer below. n + 1 n + 1 n n n – 1 n – 1

Service Models The service model specifies the manner in which information is transferred. Connection-oriented Connectionless

Layer n connection-oriented service Connection setup Message transfer Connection release Example: TCP, PPP n + 1 peer process send receive Layer n connection-oriented service SDU

Connectionless Transfer Service No setup Each message sent independently Must provide all address information per message Simple & quick Example: UDP, IP n + 1 peer process send n + 1 peer process receive SDU Layer n connectionless service

Automatic Repeat Request (ARQ) Purpose: To pass to the receiver every frame correctly, only once, in order. Bad things can happen: Error, arbitrary delay, out-of-order arrival, or loss. Aim at very high reliability. Assume if frames arrive, they arrive in-order for now. We save the out-of-order problem for later. Basic elements: Error-detecting code ACKs (positive acknowledgments) NAKs (negative acknowledgments) Timeout mechanism

Timer set after each frame transmission Stop-and-Wait ARQ Transmit a frame, wait for ACK Error-free packet Packet Information frame Transmitter Receiver Timer set after each frame transmission Control frame

Need for Sequence Numbers (a) Frame 1 lost A B Frame 1 ACK Time Time-out 2 (b) ACK lost A B Frame 1 ACK Time Time-out 2 In cases (a) & (b) the transmitting station A acts the same way But in case (b) the receiving station B accepts frame 1 twice Question: How is the receiver to know the second frame is also frame 1? Need a sequence number: Slast=SN of most recent transmitted frame.

Sequence Numbers What if ACK only if Slast=Rnext? (c) Premature Time-out A B Frame ACK 1 Time Time-out 2 The transmitting station misinterprets duplicate ACKs Question: How is the receiver to know second ACK is for frame 0? Need SN in ACK: Rnext=SN of next frame expected by the receiver. Implicitly acknowledges receipt of all prior frames. What if ACK only if Slast=Rnext?

How many bits for SN? 1-Bit SN Suffices Rnext Slast Timer Transmitter A Receiver B Slast Rnext 0 1 Timer

Finite State Machine Slast Transmitter A Receiver B Rnext Frame 0 (0,0) (0,1) (1,0) (1,1) Global State: (Slast, Rnext) Error-free frame 0 arrives ACK 0 ACK 1 Error-free frame 1 Frame 0 lost/error Frame 1

S/W Efficiency t Last frame bit enters channel ACK arrives First frame bit enters channel Last frame bit enters channel Transmitter waits for ACK Last frame bit arrives at receiver Receiver processes frame and prepares ACK ACK arrives First frame bit arrives at receiver t

S/W Transmission Time tprop tack tproc B tprop tack tproc t0 = total time to transmit 1 frame if no error frame tf time bits/info frame bits/ACK frame channel transmission rate

Efficiency on Error-free channel Overhead bits (header, CRC) Effective transmission rate: Transmission efficiency: Effect of frame overhead Effect of Delay-Bandwidth Product Effect of ACK frame

Delay-Bandwidth Product nf=10,000 bits, na=no=200 bits 2xDelayxBW Efficiency 1 ms 200 km 10 ms 2000 km 100 ms 20,000 km 1 sec 200,000 km 1 Mbps 103 88% 104 49% 105 9% 106 1% 1 Gbps 107 0.1% 108 0.01% 109 0.001% S/W inefficient for very high speeds or long delays

Average Transmission Number Proposition: Let Pf be the frame error probability. Then the average number of transmissions per successful frame is 1/ (1–Pf ). Proof: The number of transmissions to first correct arrival has geometric distribution. E.g., if 1-in-10 gets through, then in average 10 tries to success.

Efficiency in Channel with Errors Assuming time-out is equal to t0 (it should be larger) Effect of frame loss If bit-error-rate is p, then

Go-Back-N A sliding-window protocol. Keep channel busy by continuing to send frames Allow a window of up to Ws outstanding frames If ACK for oldest frame arrives before window is exhausted, we can continue transmitting If window is exhausted, pull back and retransmit all outstanding frames

Go-Back-N ARQ Go-Back-4: Time A B fr Time 1 2 3 4 5 6 ACK1 out of sequence frames Go-Back-4: 4 frames are outstanding; so go back 4 7 8 9 ACK2 ACK3 ACK4 ACK5 ACK6 ACK7 ACK8 ACK9 Rnext 0 1 2 3 3 4 5 6 7 8 9 Frame transmission are pipelined to keep the channel busy Frame with errors and subsequent out-of-sequence frames are ignored

Choose Window Size > RTT A B Time fr Time-out 1 ACK1 Stop-and-Wait ARQ Receiver is looking for Rnext=0 A B fr Time 1 2 3 Receiver is looking for Rnext=0 Out-of-sequence frames If window exhausted, go back N 4 5 6 Go-Back-N ARQ ACK1 ACK2 ACK3 ACK4 ACK5 ACK6

Go-Back-N with Timeout Problem with Go-Back-N as presented: If frame is lost and source does not have frame to send, then window will not be exhausted and recovery will not commence Use a timeout with each frame When timeout expires, resend all outstanding frames

Go-Back-N Transmitter & Receiver Timer Slast Slast+1 Srecent Slast+Ws-1 Transmitter ... Buffers Send Window (size Ws) Frames transmitted and ACKed most recent transmission oldest un-ACKed frame max SN allowed Receiver Receive Window (size 1) Rnext Frames received Receiver will only accept error-free frame with SN Rnext. When the frame arrives Rnext is incremented by 1, so the receive window slides forward by 1.

Maximum Window Size Ws = 2m-1 Example: M = 22 = 4, Go-Back – 4 is not good. A B fr Time 1 2 3 ACK1 ACK ACK2 ACK3 Transmitter goes back 4 Receiver has Rnext= 0, but it does not know whether this is the old frame 0 or a new frame 0 Rnext 0 1 2 3 0 Example: Go-Back-3 is good. A B fr Time 1 2 ACK1 ACK2 ACK3 Receiver has Rnext= 3 , so it rejects the old frame 0 Rnext 0 1 2 3

ACK Piggybacking in Bidirectional GBN In bi-directional communication, ACKs are often piggybacked on data frames to reduce overhead. Transmitter Receiver SArecent RA next SBrecent RB next

Choice of Timeout & Window Size Tf Tproc Tprop Tout Timeout value should allow for: 2 Tprop + Tproc A frame begins transmission right before the first frame arrives Tf Next frame carries the ACK, Tf (piggy-back) Thus, timeout > 2 Tprop + 2 Tf + Tproc Ws should be large enough to keep channel busy for Tout

Efficiency of Go-Back-N if channel is error-free and Ws is large enough to keep channel busy Assume Pf frame loss probability, time to deliver a frame is: tf if first attempt succeeds Tf + Wstf /(1-Pf) otherwise go back Ws and try again Delay-bandwidth product determines Ws

Improvement over Go-Back-N? Go-Back-N repeats multiple frames when a few errors or losses occur How about retransmitting only an individual frame? Selective Repeat ARQ Timeout pinpoints individual frame Receiver maintains a window of acceptable SN Error-free, but out-of-sequence frames with SN within the receive window are buffered Arrival of Rnext causes window to slide forward by 1 or more NAK causes retransmission of oldest un-acked frame

Selective Repeat ARQ A B fr Time 1 2 3 4 5 6 ACK1 8 9 7 10 11 12 ACK2 Time 1 2 3 4 5 6 ACK1 8 9 7 10 11 12 ACK2 NAK2 ACK7 ACK8 ACK9 ACK10 ACK11 ACK12

Selective Repeat ARQ Transmitter Receiver Buffers Slast Slast+ Ws-1 ... Send Window Srecent Frames transmitted and ACKed Timer Slast+ 1 Slast+ Ws - 1 Frames received Receiver Receive Window Rnext Rnext + Wr-1 Rnext+ 1 Rnext+ 2 Rnext+ Wr- 1 ... Buffers max Seq # accepted

Send & Receive Windows 1 2 i i + Ws – 1 2m-1 Slast send window i + 1 Transmitter Receiver 1 2 i i + Ws – 1 2m-1 Slast send window i + 1 Moves k forward when ACK arrives with Rnext = Slast + k k = 1, …, Ws-1 1 2 i j + Wr – 1 2m-1 Rnext receive window j Moves forward by 1 or more when frame arrives with Seq. # = Rnext

What size Ws and Wr allowed? Example: M=22=4, Ws=3, Wr=3 A B fr0 Time fr1 fr2 ACK1 ACK2 ACK3 Frame 0 resent {0,1,2} {1,2} {2} {.} Send Window {1,2,3} Receive Window {2,3,0} {3,0,1} Old frame 0 accepted as a new frame because it falls in the receive window

Ws + Wr = 2m is maximum allowed Example: M=22=4, Ws=2, Wr=2 A B fr0 Time fr1 ACK1 ACK2 Frame 0 resent {0,1} {1} {.} Send Window {1,2} Receive Window {2,3} Old frame 0 rejected because it falls outside the receive window

Why Ws + Wr = 2m works The number of bits, m, is enough to label all outstanding frames. Usually, Ws = Wr = 2m-1 2m-1 1 2m-1 1 Ws +Wr-1 Slast 2 2 receive window Rnext Ws send window Ws-1

Efficiency of Selective Repeat # of transmissions required to deliver a frame is: tf / (1-Pf)

Example: Impact Bit Error Rate on Selective Repeat nf=10,000 bits, na=no=200 bits p = 0, 10-6, 10-5, 10-4 and R = 1 Mbps & 100 ms 1 Mbps x 100 ms = 100000 bits = 10 frames → Use Ws = 11 Efficiency 10-6 10-5 10-4 S&W 8.9% 8.8% 8.0% 3.3% GBN 98% 88.2% 45.4% 4.9% SR 97% 89% 36% GBN >> S&W for large delay-bandwidth product GBN becomes inefficient as error rate increases SR is the best. Efficiency drops as error rate increases

Comparison of ARQ Efficiencies Assume na, no << nf, and L = 2(tprop+tproc)R/nf =(Ws-1). Selective-Repeat: Go-Back-N: For Pf≈0, SR & GBN same For Pf→1, GBN & SW same Stop-and-Wait:

Delay-Bandwidth product = 10, 100 ARQ Efficiencies 10-9 10-8 10-7 10-6 10-5 10-4 10-3 10-2 10-1 p Delay-Bandwidth product = 10, 100

Standard Data Link Layer Protocols: PPP & HDLC (Chapter 5 Standard Data Link Layer Protocols: PPP & HDLC (Chapter 5.5-6 in Leon-Garcia)

DLL “Packet” “Frame” Network Network layer layer Data link Data link Physical layer Physical layer

PPP: Point-to-Point Protocol A data link layer protocol. Encapsulating IP packets over point-to-point links. Router-router; Dial-up to router (PC to Internet service provider (ISP)) Functions: Provides Framing and Error Detection Link Control Protocols Set up, configure, testing, maintain, terminate; Authentication: Password Authentication Protocol, etc. Network Control Protocols Configure network layer protocols E.g., IP, IPX (Novell), Appletalk

PPP Frame Format CRC 16 or CRC 32 All stations are to accept the frame Flag Address Control Information FCS Protocol 01111110 1111111 00000011 CRC 16 or CRC 32 1 or 2 variable 2 or 4 All stations are to accept the frame HDLC Unnumbered frame Can support multiple network protocols simultaneously Specifies what kind of packet is contained in the payload

High-Level Data Link Control (HDLC) Bit-oriented data link control Derived from IBM Synchronous Data Link Control (SDLC)

HDLC Data Transfer Modes Normal Response Mode Used in polling multidrop lines Primary Commands Responses Secondary Asynchronous Balanced Mode Used in full-duplex point-to-point links Primary Secondary Commands Responses Mode is selected during connection establishment

HDLC Frame Format Flag Address Control Information FCS Control field gives HDLC its functionality Codes in fields have specific meanings and uses Flag: delineate frame boundaries Address: identify secondary station (1 or more octets) Control: purpose & functions of frame (1 or 2 octets) Information: user data; length not standardized Frame Check Sequence: 16- or 32-bit CRC

Control Field Format N(S) N(R) P/F 1 2-4 5 6-8 Information Frame N(S) N(R) P/F 1 2-4 5 6-8 Information Frame Supervisory Frame S Unnumbered Frame M S: Supervisory Function Bits N(R): Receive Sequence Number N(S): Send Sequence Number M: Unnumbered Function Bits P/F: Poll/final bit used in interaction between primary and secondary Note: The information frames and supervisory frames allow HDLC to implement Stop-and-Wait, Go-Back-N, and Selective Repeat ARQ. Note: The unnumbered frames implement control functions.

Example: HDLC Using Polling Address of secondary Primary A Secondaries B, C B, RR, 0, P B, I, 0, 0 B, I, 1, 0 B, I, 2, 0,F X B, SREJ, 1 C, RR, 0, P C, RR, 0, F B, SREJ, 1,P B, I, 3, 0 B, I, 4, 0, F B, I, 0, 5 Time A polls B RR=receive ready N(S) N(R) N(R) B sends 3 info frames A rejects fr1 A polls C C nothing to send A polls B, requests selective retrans. fr1 B resends fr1 Then fr 3 & 4 A send info fr0 to B, ACKs up to 4

HDLC Flow Control Flow control prevents transmitter from overrunning receiver buffers. Receiver can control flow by delaying acknowledgement messages. Receiver can also use supervisory frames to explicitly control transmitter Receive Not Ready (RNR) & Receive Ready (RR) I3 I4 I5 I6 RNR5 RR6