Data Link Layer Savera Tanwir. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.

Slides:



Advertisements
Similar presentations
Chapter 3 The Data Link Layer.
Advertisements

Data Link Layer Protocols Flow Control in Data Link Layer.
The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
EE 4272Spring, 2003 Chapter 7 Data Link Control Objectives: Effective & reliable data communication between two directly connected transmitting-receiving.
Chapter 3: The Datalink Layer CS 455/555. Topics to be covered Design Issues Error detection and correction Elementary datalink protocols Sliding window.
Flow and Error Control. Flow Control Flow control coordinates the amount of data that can be sent before receiving acknowledgement It is one of the most.
8-Reliability and Channel Coding Dr. John P. Abraham Professor UTPA.
EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
EEC-484/584 Computer Networks Lecture 14 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
EEC-484/584 Computer Networks Lecture 12 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao
EEC-484/584 Computer Networks Lecture 6 Wenbing Zhao
PART III DATA LINK LAYER. Position of the Data-Link Layer.
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.
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 12 Introduction to Computer Networks.
CMPE 150- Introduction to Computer Networks 1 CMPE 150 Fall 2005 Lecture 13 Introduction to Computer Networks.
EEC-484/584 Computer Networks Lecture 14 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
The Data Link Layer Chapter 3. Position of the data-link layer.
EE 122: Error detection and reliable transmission Ion Stoica September 16, 2002.
The OSI Reference Model
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao (Part of the slides are based on Drs. Kurose & Ross ’ s slides for their Computer.
EEC-484/584 Computer Networks Lecture 13 Wenbing Zhao
Circuit Switching (a) Circuit switching. (b) Packet switching.
CMPE 150 – Winter 2009 Lecture 6 January 22, 2009 P.E. Mantey.
CSC 450/550 Part 2: The Data Link Layer. CSC 450/550 Summary Part A Functions (1)Functions of the data link layer (2)Framing (3)Error control (3.1) Error.
The Data Link Layer Chapter 3. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
CS352- Link Layer Dept. of Computer Science Rutgers University.
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.
1 Reliable Data Transfer. 2 r Problem: Reliability  Want an abstraction of a reliable link even though packets can be corrupted or get lost r Solution:
EEC-484/584 Computer Networks Lecture 7 Wenbing Zhao
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 Link Layer We have now discussed the prevalent shared channel technologies  Ethernet/IEEE  Wireless LANs (802.11) We have now covered chapters.
The Data Link Layer Chapter 3. Data Link Layer Design Issues a) Services Provided to the Network Layer b) Framing c) Error Control d) Flow Control.
PART III DATA LINK LAYER. Position of the Data-Link Layer.
Chi-Cheng Lin, Winona State University CS 313 Introduction to Computer Networking & Telecommunication Data Link Layer Part I – Designing Issues and Elementary.
Chapter 3 THE DATA LINK LAYER
CEN 4500 Data Communications Instructor: S. Masoud Sadjadi sadjadi At cs Dot fiu Dot edu Chapter 3: The Data Link.
ICOM 6115©Manuel Rodriguez-Martinez ICOM 6115 – Computer Networks and the WWW Manuel Rodriguez-Martinez, Ph.D. Lecture 14.
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.
Data Link Layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
Data Link Layer : Services, Framing, Error Detection and Correction2.
The data link layer. Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control.
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.
Chapter 3 The Data Link Layer (60 % practical part)
The Data Link Layer Chapter 3 10/28/2015www.noteshit.com1.
Computer Networks Lecture 3: Data Link - part II Based on slides from D. Choffnes Northeastern U. and P. Gill from StonyBrook University Revised Autumn.
CHAPTER 3: DATA LINK CONTROL Flow control, Error detection – two dimensional parity checks, Internet checksum, CRC, Error control, Transmission efficiency.
The Data Link Layer Chapter 3 1/21/2016www.ishuchita.com1.
Computer Networks, Fifth Edition by Andrew Tanenbaum and David Wetherall, © Pearson Education-Prentice Hall, 2011 The Data Link Layer Chapter 3.
Chi-Cheng Lin, Winona State University CS412 Introduction to Computer Networking & Telecommunication Data Link Layer Part II – Sliding Window Protocols.
1 The Data Link Layer A. S. Tanenbaum Computer Networks W. Stallings Data and Computer Communications Chapter 3.
Chapter 3: The Data Link Layer –to achieve reliable, efficient communication between two physically connected machines. –Design issues: services interface.
The Data Link Layer RIS 251 Dr. ir. S.S. Msanjila.
Chapter 3 The Data Link Layer.
The Data Link Layer.
Data Link Layer Flow Control.
Data Link Layer.
Data Link Layer.
Data Link Layer What does it do?
Chapter 3 – Part 1 The Data Link Layer.
Overview Jaringan Komputer (2)
CS412 Introduction to Computer Networking & Telecommunication
The Data Link Layer Chapter
Data Link Layer. Position of the data-link layer.
Presentation transcript:

Data Link Layer Savera Tanwir

Data Link Layer Design Issues Services Provided to the Network Layer Framing Error Control Flow Control

Functions of the Data Link Layer Provide service interface to the network layer Dealing with transmission errors Regulating data flow Slow receivers not swamped by fast senders

Functions of the Data Link Layer (2) Relationship between packets and frames.

Services Provided to Network Layer (a) Virtual communication. (b) Actual communication.

Services Provided to Network Layer Unacknowledged Connectionless Service No logical connection is established beforehand and released No re-transmission in case of loss Appropriate when the error rate is very low Acknowledged connectionless Service Each frame is individually acknowledged Packet acknowledgement vs frame ack? Wireless systems Acknowledged Connection Oriented Service Connection establishment and termination

Services Provided to Network Layer (2) Placement of the data link protocol.

Framing A character stream. (a) Without errors. (b) With one error.

Framing (2) (a) A frame delimited by flag bytes. (b) Four examples of byte sequences before and after stuffing.

Framing (3) Bit stuffing (a) The original data. (b) The data as they appear on the line. (c) The data as they are stored in receiver’s memory after destuffing.

In a single-bit error, only 1 bit in the data unit has changed. Errors

A burst error means that 2 or more bits in the data unit have changed.

Error detection/correction Error detection Check if any error has occurred Don’t care the number of errors Don’t care the positions of errors Error correction Need to know the number of errors Need to know the positions of errors More difficult

Error Detection and Correction Used on many link types Can be used anytime you don’t trust the media Caches,memories, disks Major Algorithmic Strategies: Parity 1 and 2 dimensional Hamming codes (Interleaved Parity Codes) Checksums Cyclic Redundancy Codes (CRC)

To detect or correct errors, we need to send extra (redundant) bits with data.

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

Hamming Distance The Hamming distance between two words is the number of differences between corresponding bits. The minimum Hamming distance is the smallest Hamming distance between all possible pairs in a set of words.

We can count the number of 1s in the Xoring of two words 1. The Hamming distance d(000, 011) is 2 because 2. The Hamming distance d(10101, 11110) is 3 because

Find the minimum Hamming distance of the coding scheme in Table Solution We first find all Hamming distances. Example The d min in this case is 2.

Minimum Distance for Error Detection To guarantee the detection of up to s errors in all cases, the minimum Hamming distance in a block code must be d min = s + 1. Why?

The minimum Hamming distance for our first code scheme is 2. This code guarantees detection of only a single error. For example, if the third codeword (101) is sent and one error occurs, the received codeword does not match any valid codeword. If two errors occur, however, the received codeword may match a valid codeword and the errors are not detected. Example 10.7

Table has d min = 3. This code can detect up to two errors. When any of the valid codewords is sent, two errors create a codeword which is not in the table of valid codewords. The receiver cannot be fooled. What if there are three error occurrance? Example 10.8

Hamming Codes Want to be able to correct error with less overhead than 2D parity Hamming codes correct all single bit errors with only log(M) extra bits and detect double bit errors Uses an interleaved parity scheme

Calculating a Hamming Code Procedure: Place message bits in their non-power-of-two Hamming positions Build a table listing the binary representation for each of the message bit positions Calculate the check bits

Hamming Code Example Message to be sent: n : check bits Position

Hamming Code Example Calculate check bits: 3 = = = = = = = = Message to be sent: n : check bits Position

1 Starting with the 2 0 position: Look at positions with 1’s in them Count the number of 1’s in the corresponding message bits If even, place a 1 in the 2 0 check bit, i.e., use odd parity Otherwise, place a 0 Calculate check bits: 3 = = = = = = = = Message to be sent: n : check bits Position Hamming Code Example

Repeat with the 2 1 position: Look at positions those positions with 1’s in them Count the number of 1’s in the corresponding message bits If even, place a 1 in the 2 1 check bit Otherwise, place a 0 10 Calculate check bits: 3 = = = = = = = = Message to be sent: n : check bits Position Hamming Code Example

10 Repeat with the 2 2 position: Look at positions those positions with 1’s in them Count the number of 1’s in the corresponding message bits If even, place a 1 in the 2 2 check bit Otherwise, place a 0 1 Calculate check bits: 3 = = = = = = = = Message to be sent: n : check bits Position Hamming Code Example

Original message = 1011 Sent message = Now, how do we check for a single-bit error in the sent message using the Hamming code?

Using Hamming Codes to Correct Single-Bit Errors Received message: n : check bits Calculate check bits: 3 = = = = = = = = Position

Starting with the 2 0 position: Look at positions with 1’s in them Count the number of 1’s in both the corresponding message bits and the 2 0 check bit and compute the parity. If even parity, there is an error in one of the four bits that were checked. Odd parity: No error in bits 1, 3, 5, 7 Received message: n : check bits Calculate check bits: 3 = = = = = = = = Position Using Hamming Codes to Correct Single-Bit Errors

Repeat with the 2 1 position: Look at positions with 1’s in them Count the number of 1’s in both the corresponding message bits and the 2 1 check bit and compute the parity. If even parity, there is an error in one of the four bits that were checked. Even parity: ERROR in bit 2, 3, 6 or 7! Received message: n : check bits Calculate check bits: 3 = = = = = = = = Position Using Hamming Codes to Correct Single-Bit Errors

Repeat with the 2 2 position: Look at positions with 1’s in them Count the number of 1’s in both the corresponding message bits and the 2 2 check bit and compute the parity. If even parity, there is an error in one of the four bits that were checked. Even parity: ERROR in bit 4, 5, 6 or 7! Received message: n : check bits Calculate check bits: 3 = = = = = = = = Position Using Hamming Codes to Correct Single-Bit Errors

Position Finding the error’s location

No error in bits 1, 3, 5, Position Finding the error’s location

ERROR in bit 2, 3, 6 or 7 ERROR in bit 4, 5, 6 or 7 Error must be in bit 6 because bits 3, 5, 7 are correct, and all the remaining information agrees on bit 6 erroneous bit, change to Position Finding the error’s location

Finding the error’s location An Easier Alternative to the Last Slide 3 = = = = = = = = EENE 110 = 6 E = error in column NE = no error in column

Hamming Codes Hamming codes can be used to locate and correct a single-bit error If more than one bit is in error, then a Hamming code cannot correct it Hamming codes, like parity bits, are only useful on short messages

Error Detecting Codes Error correcting codes are simply too expensive for reliable links Usually we only use error detection combined with retransmissions CRC (Cyclic Redundancy Check) Frame bits are seen as polynomial M(x) e.g => M(x) = x 5 + x Sender/receiver use generator polynomial G(x) of degree r Append r ‘0’ bits to lower end of frame generated by M(x) Perform polynomial division using G(x) and append remainder to M(x), to get T(x) Receiver computes T(x) / G(x) and checks remainder

Error-Detecting Codes Calculation of the polynomial code checksum.

Standard Polynomials NamePolynomialApplication CRC-8x 8 + x 2 + x + 1ATM header CRC-10x 10 + x 9 + x 5 + x 4 + x 2 + 1ATM AAL ITU-16x 16 + x 12 + x 5 + 1HDLC ITU-32 x 32 + x 26 + x 23 + x 22 + x 16 + x 12 + x 11 + x 10 + x 8 + x 7 + x 5 + x 4 + x 2 + x + 1 IEEE 802

Elementary Data Link Protocols An Unrestricted Simplex Protocol A Simplex Stop-and-Wait Protocol A Simplex Protocol for a Noisy Channel

Protocol Definitions Continued  Some definitions needed in the protocols to follow. These are located in the file protocol.h.

Protocol Definitions (ctd.) Some definitions needed in the protocols to follow. These are located in the file protocol.h.

Unrestricted Simplex Protocol Communication is simplex No errors take place on the physical channel The sender/receiver can generate/consume an infinite amount of data Infinite buffer space is available Processing time can be ignored Always ready for sending/receiving

Unrestricted Simplex Protocol

Simplex Stop-and-Wait Protocol Most unrealistic assumption is dropped i.e. receiver can process incoming data infinitely fast Channel is still assumed to be error free Data traffic is still simplex Problem: How to prevent the sender from flooding the receiver (Flow Control)? The receiver requires a time (  t) to execute Solution The sender must transmit at an average rate less than one frame per  t Calculate the worst case behavior of the receiver e.g. each frame encounters the same delay Problem: There will be no overruns, but the link utilization will be extremely poor Solution Sender ships one frame and then waits for acknowledgment (stop and wait) The contents of the acknowledgment frame are unimportant Data transmission cannot be one directional Requires Half-duplex physical channel

Simplex Stop-and- Wait Protocol

A Simplex Protocol for a Noisy Channel A positive acknowledgement with retransmission protocol. Continued 

A Simplex Protocol for a Noisy Channel (ctd.) A positive acknowledgement with retransmission protocol.

Unresolved Problems of Simplex Protocols Timer duration : How long should the timer be? What if too long? (inefficient) What if too short? (unnecessary retransmission) Poor Link Utilization results due to Stop-and-Wait

Sliding Window Protocols A One-Bit Sliding Window Protocol A Protocol Using Go Back N A Protocol Using Selective Repeat

Sliding Window Protocol There is a need for transmitting data in both directions Different channels for data in each direction Same channel for data in both directions For example, using a kind field in the header of an incoming frame, the receiver can tell if frame is data or ACK Piggybacking Instead of sending a separate control (ACK) frame, the ACK is attached to the outgoing data frame Advantage: Better use of the channel bandwidth (just a few extra bits) Issue: How long should the data link layer wait for a packet onto which to piggyback the acknowledgement?

Piggybacking

Sliding Window Protocol Concept behind all sliding window protocols Each frame contains a sequence number Maximum number is 2 n –1 (to fit in an n bit field) At any instant of time, the sender maintains a set of sequence numbers it is permitted to send called sending window The receiver also maintains a receiving window, corresponding to the frames it is permitted to accept Both windows need not have same upper and lower limits and can grow or shrink as frames are sent and received

Sliding Window Protocol Sender’s perspective The frames in the sender’s window represent frames that ‘have been sent but not yet acknowledged’ or ‘can be sent’ Frames in sender’s window may be lost or damaged, the sender must keep all these frames in its memory for possible retransmissions If max window size is n, the sender needs n buffer spaces to hold the unacknowledged frames Whenever a new packet arrives from the network layer, it is Given the next highest sequence number The upper boundary of the window is advanced by one When an acknowledgement comes in, the lower boundary is advanced by one

After receiving ACKs for Frame 0 and 1 Example – 3-bit Sender Sliding Window

Sliding Window Protocol Receiver’s Perspective The receiver’s window corresponds to the frames it may accept If a frame comes that lies outside the receiver’s window, its discarded If it receives a frame whose sq. no. matches its expectation, it is Passed to the NL ACK is generated Complete window is moved by 1 Receiver’s window always reserves its size NL is always given data in-order, regardless of receiver’s window size

Example – 1-bit Receiver Sliding Window After receiving Frame 0 from Sender

A One-Bit Sliding Window Protocol Continued 

A One-Bit Sliding Window Protocol (ctd.)

A One-Bit Sliding Window Protocol (2) Two scenarios for protocol 4. (a) Normal case. (b) Abnormal case. The notation is (seq, ack, packet number). An asterisk indicates where a network layer accepts a packet.

Link Utilization Problem In 1-bit protocol, the sender can only have one unACKed frame outstanding Consider a 50 kbps channel with 500 msec round-trip propagation delay used to send 1000 bit frames Transmission time t = 20 ms Frame will arrive at destination after 270 ms ACK will get back after 520 ms (Assuming no delay at receiver) So sender was idle for 500/520 ≈ 96% of the time Thus, a combination of long propagation delay, high bandwidth and short frame length destroys efficiency One solution, use larger frames, but the maximum size is limited by the bit error rate (BER) of the channel

Solution  Pipelining Allow more frames to be in transmission simultaneously, instead of just 1 frame If channel bandwidth is b bits/sec, frame length is ℓ bits & round-trip propagation is R sec Time to transmit single frame = ℓ /b bits Line utilization = ℓ /( ℓ + bR ) Issues with pipelining Provides more efficient use of bandwidth, but error handling is more complex If 20 frames are transmitted and only the 2 nd had an error Will frames be ignored at receiver side? Will the sender have to retransmit all frames again?

A Protocol Using Go-Back-N Discard all subsequent frames, sending no acknowledgement for the discarded frames EDDDDDD discarded by receiver frame with error timeout interval ACK 0 ACK 1ACK 2 ACK 3 ACK 4 ACK 5 ACK 6 ACK 7 Time sender receiver

A Protocol Using Go-Back-N Corresponds to receive window size of 1 Go-back-N works fine if the retransmissions rarely occur Wastes a lot of bandwidth if error rate is high Requires lesser buffer size at the receiver

Selective-Repeat Receiver sends a NAK when it detects an error Sender sends the required frame on receiving NAK

Sliding Window Protocol Using Go Back N Continued 

Sliding Window Protocol Using Go Back N Continued 

Sliding Window Protocol Using Go Back N Continued 

Sliding Window Protocol Using Go Back N

Sliding Window Protocol Using Go Back N (2) Simulation of multiple timers in software.

A Sliding Window Protocol Using Selective Repeat Continued 

A Sliding Window Protocol Using Selective Repeat (2)

A Sliding Window Protocol Using Selective Repeat (3) Continued 

A Sliding Window Protocol Using Selective Repeat (4)

A Sliding Window Protocol Using Selective Repeat (5) (a) Initial situation with a window size seven. (b) After seven frames sent and received, but not acknowledged. (c) Initial situation with a window size of four. (d) After four frames sent and received, but not acknowledged.

Acknowledgements Ali Sajjad’s lectures