DATA LINK LAYER UNIT 7.

Similar documents
ERROR AND FLOW CONTROL. Lecture: 10 Instructor Mazhar Hussain

The data link layer has a number of specific functions it can carry out. These functions include. Figure 2-1. Relationship between packets and frames.

Chapter 3. The Data Link Layer. Wesam A. Hatamleh

SRI RAMAKRISHNA INSTITUTE OF TECHNOLOGY DEPARTMENT OF INFORMATION TECHNOLOGY COMPUTER NETWORKS UNIT - II DATA LINK LAYER

Department of Computer and IT Engineering University of Kurdistan. Data Communication Netwotks (Graduate level) Data Link Layer

The Data Link Layer Chapter 3

PART III. Data Link Layer MGH T MGH C I 204

COMPUTER NETWORKS UNIT-3

Chapter 11 Data Link Control 11.1

4. Error correction and link control. Contents

Chapter 3. The Data Link Layer

CS 640 Introduction to Computer Networks. Role of data link layer. Today s lecture. Lecture16

Inst: Chris Davison

Chapter 11 Data Link Control 11.1

Advanced Computer Networks. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS University, Lahore Pakistan. Department of Computer Science

EITF25 Internet Techniques and Applications L3: Data Link layer. Stefan Höst

The flow of data must not be allowed to overwhelm the receiver

CSMC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. Nov 1,

Chapter 11 Data Link Control 11.1

I. INTRODUCTION. each station (i.e., computer, telephone, etc.) directly connected to all other stations

CS254 Network Technologies. Lecture 2: Network Models & Error Detection and Correction. Dr Nikos Antonopoulos

Data link layer functions. 2 Computer Networks Data Communications. Framing (1) Framing (2) Parity Checking (1) Error Detection

TYPES OF ERRORS. Data can be corrupted during transmission. Some applications require that errors be detected and corrected.

2.1 CHANNEL ALLOCATION 2.2 MULTIPLE ACCESS PROTOCOLS Collision Free Protocols 2.3 FDDI 2.4 DATA LINK LAYER DESIGN ISSUES 2.5 FRAMING & STUFFING

Analyzation of Automatic Repeat Request (ARQ) Protocols

CS422 Computer Networks

LECTURE #34. Data Communication (CS601)

UNIT-II 1. Discuss the issues in the data link layer. Answer:

CSMC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala Set 4. September 09 CMSC417 Set 4 1

Comparison of ISO-OSI and TCP/IP Suit. Functions of Data Link Layer:

Data Link Control. Surasak Sanguanpong Last updated: 11 July 2000

CSE 123: Computer Networks

The Data Link Layer Chapter 3

Ch. 7 Error Detection and Correction

CS 4453 Computer Networks Winter

Data Link Layer: Overview, operations

Telecom Systems Chae Y. Lee. Contents. Flow Control Error Detection/Correction Link Control (Error Control) Link Performance (Utility)

CHANNEL CODING 1. Introduction

Networking Link Layer

10.1 REVIEW QUESTIONS

COMPUTER NETWORKS UNIT I. 1. What are the three criteria necessary for an effective and efficient networks?

Lecture 5. Homework 2 posted, due September 15. Reminder: Homework 1 due today. Questions? Thursday, September 8 CS 475 Networks - Lecture 5 1

Outline. EEC-484/584 Computer Networks. Data Link Layer Design Issues. Framing. Lecture 6. Wenbing Zhao Review.

Data Link Technology. Suguru Yamaguchi Nara Institute of Science and Technology Department of Information Science

2.4 Error Detection Bit errors in a frame will occur. How do we detect (and then. (or both) frames contains an error. This is inefficient (and not

Introduction to Data Communications & Networking

CSCI-1680 Link Layer I Rodrigo Fonseca

Lecture 2 Error Detection & Correction. Types of Errors Detection Correction

Chapter 10 Error Detection and Correction. Copyright The McGraw-Hill Companies, Inc. Permission required for reproduction or display.

Lecture 4: CRC & Reliable Transmission. Lecture 4 Overview. Checksum review. CRC toward a better EDC. Reliable Transmission

Overview. Data Link Technology. Role of the data-link layer. Role of the data-link layer. Function of the physical layer

Lecture / The Data Link Layer: Framing and Error Detection

Transmission SIGNALs

Lecture 5: Flow Control. CSE 123: Computer Networks Alex C. Snoeren

Jaringan Komputer. Data Link Layer. The Data Link Layer. Study the design principles

TCP: Flow and Error Control

Data Link Layer. Overview. Links. Shivkumar Kalyanaraman

EE 122: Error detection and reliable transmission. Ion Stoica September 16, 2002

Chapter Six. Errors, Error Detection, and Error Control. Data Communications and Computer Networks: A Business User s Approach Seventh Edition

MYcsvtu Notes DATA REPRESENTATION. Data Types. Complements. Fixed Point Representations. Floating Point Representations. Other Binary Codes

CSE 461: Framing, Error Detection and Correction

16.682: Communication Systems Engineering. Lecture 17. ARQ Protocols

High Level View. EE 122: Error detection and reliable transmission. Overview. Error Detection

Advanced Computer Networks. Rab Nawaz Jadoon DCS. Assistant Professor COMSATS University, Lahore Pakistan. Department of Computer Science

Data Link Layer. Srinidhi Varadarajan

Computer Network. Direct Link Networks Reliable Transmission. rev /2/2004 1

Introduction to Computer Networks. 03 Data Link Layer Introduction

Lecture 7: Flow Control"

C08a: Data Link Protocols

Lecture 5: Data Link Layer Basics

Telecommunication Protocols Laboratory Course

Chapter 23 Process-to-Process Delivery: UDP, TCP, and SCTP 23.1

06/05/2008. Chapter 3. The Data Link Layer. Data Link Layer Design Issues. Services Provided to the Network Layer. Error Control Flow Control

William Stallings Data and Computer Communications. Chapter 7 Data Link Control

Data Link Layer. Goals of This Lecture. Engineering Questions. Outline of the Class

Data Link Layer (1) Networked Systems 3 Lecture 6

Announcements. No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

CMSC 2833 Lecture 18. Parity Add a bit to make the number of ones (1s) transmitted odd.

Data Link Layer. Learning Objectives. Position of the data-link layer. MCA 207, Data Communication & Networking

Lecture 11 Overview. Last Lecture. This Lecture. Next Lecture. Medium Access Control. Flow and error control Source: Sections , 23.

No book chapter for this topic! Slides are posted online as usual Homework: Will be posted online Due 12/6

CMSC 417. Computer Networks Prof. Ashok K Agrawala Ashok Agrawala. October 11, 2018

Point-to-Point Links. Outline Encoding Framing Error Detection Sliding Window Algorithm. Fall 2004 CS 691 1

Chapter 10 Error Detection and Correction 10.1

Networking Technologies and Applications

Transport Protocols & TCP TCP

Data Link Layer, Part 5 Sliding Window Protocols. Preface

Outline. CS5984 Mobile Computing

Data Link Networks. Hardware Building Blocks. Nodes & Links. CS565 Data Link Networks 1

Islamic University of Gaza Faculty of Engineering Department of Computer Engineering ECOM 4021: Networks Discussion. Chapter 2.

Computer Networking : Principles, Protocols and Practice

(Refer Slide Time: 2:20)

23-3 TCP. Topics discussed in this section: TCP Services TCP Features Segment A TCP Connection Flow Control Error Control 23.22

Chapter 3. The Data Link Layer


INF Data Communication Data Link Layer

Data Link Layer. Indian Institute of Technology Madras

CSCI-1680 Link Layer Reliability Rodrigo Fonseca

Direct Link Communication I: Basic Techniques. Data Transmission. ignore carrier frequency, coding etc.

Data Link Layer (part 2)

Transcription:

DATA LINK LAYER UNIT 7 1

Data Link Layer Design Issues: 1. Service provided to network layer. 2. Determining how the bits of the physical layer are grouped into frames (FRAMING). 3. Dealing with transmission errors (ERROR CONTROL). 4. Regulating the flow of frames slow receivers are not swamped by fast senders (FLOW CONTROL). 2

1. Service provided to network layer: Unacknowledged connectionless service Acknowledged connectionless service Acknowledged connection oriented service 3

2. Framing: Break bit stream into frames. Check if frames arrived correctly. If not: Discards frame. In some cases also request retransmission. 4

Framing Methods: 1 Character count 2 Starting and ending characters, with character stuffing 3 Starting and ending flags, with bit stuffing 5

Character Counting If the frame slips resynchronization is a problem This method uses a field in the header to specify the number of character in the frame. 6

Starting and Ending Character Character stuffing Closely tied to 8-bit (ASCII) character Each frame start with character sequence DLE STX and end with DLE ETX Character stuffing is used when binary data,object program or floating point numbers are being transmitted. Where DLE : Data Link Escape STX: starting text 7 ETX : Ending Text

Starting and Ending flag Flag pattern : 011111I0 Each frame begin and end with pattern 01111110 After 5 consecutive 1 bits, stuff 0 bit in between At receiver end destuffs these 0 bit and get original 8 data

3. Error Control Duties of data link layer: deliver the frames in order without any error; how? Reliable delivery -Timers. -Retransmission. -Duplicate detection. Detecting errors. Detecting & Correcting errors. 4. Flow Control How to cope with fast sender and slow receiver? When the connection is established, receiver has to give feedback; grant permission to send data as e.g.: Receiver may say send n frames only to the sender. 9

Note Data can be corrupted during transmission. Some applications require that errors can be detected and corrected. 10

Error Detection and Correction Types of Errors Detection Correction

12

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

Multiple-bit error 14

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

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

Detection Methods VRC(Vertical Redundancy Check) LRC(Longitudinal Redundancy) CRC(Cyclic redundancy Check) Checksum 17

VRC(Vertical Redundancy Check) A parity bit is added to every data unit so that the total number of 1s(including the parity bit) becomes even for evenparity check or odd for odd-parity check. VRC can detect all single-bit errors. It can also detect multiple-bit or burst errors only if the total number of errors are odd. 18

Even parity VRC concept If total number of 1 bits are even than drop the parity bit and accept the data otherwise reject the data. 19

Example : Suppose a sender send a word world. Its ASCII value is : w o (119) (111) r (114) l (108) d (100) 1110111 1101111 1110010 1101100 1100100 Forward it as even parity : 11101110 11011110 11100100 11011000 11001001 Receiver received it and count the occurrence of 1 s as (6,6,4,4,4) If data is corrupted : 11111110 11011110 11101100 11011000 11001001 Receiver received it and count the occurrence of 1 s as (7,6,5,4,4) Then it will discard and ask for retransmission. 20

LRC(Longitudinal Redundancy Check) Parity bits of all the positions are assembled into a new data unit, which is added to the end of the data block 21

LRC 22

Two Dimensional Parity Check In 2D Parity check, a block of bits is divided into rows and a redundant row of bits is added to the whole block. 23

Example: Calculate LRC and VRC for following bit pattern using even parity: 1001011 0001100 1000000 1110111 Solution: VRC : Using Even Parity: 1001011 0001100 1000000 1110111 VRC : 0010 LRC : 1001011 0001100 1000000 1110111 1110000 So, 1110000 exam data unit sent by the sender. 24

Calculate the VRC and LRC for the following bit pattern using even parity:? 0100110 1110001 1100101 0000000 Solution: VRC : Using Even Parity: 0100110 1110001 1100101 0000000 VRC : 1000 LRC : 0100110 1110001 1100101 0000000 0110010 So, 0110010 exam data unit sent by the sender. 25

CRC(Cyclic Redundancy Check) ~ is based on binary division. Most powerful technique among all 26

Rules of CRC Use ExOR for adding two bits : 1 0 0 1 1 = 0 0 = 0 1 =1 0 =1 27

CRC generator ~ uses modular-2 division. Binary Division in a CRC Generator 28

Binary Division in a CRC Checker 29

Question 1. Frame 1101011011 Generator 10011 Ans - Remainder- 1110 30

Question 2. Frame 1010101010 Generator 10001 If the last bit of data is inverted during transmission as 0 to 1, Is this error detected at the receiver end? Ans - Remainder- 0010 R 1011 31

Polynomials CRC generator(divisor) is most often represented not as a string of 1s and 0s, but as an algebraic polynomial. The polynomial should have following properties: It should not be divisible by X It should be divisible by X+1. 32

A polynomial representing a divisor 33

International Standard polynomials 34

Example : A bit stream 10011101 is transmitted using the standard CRC method described in the text. The generator polynomial is x3 + 1. Show the actual bit string transmitted. Suppose the third bit from the left is inverted during transmission. Show that this error is detected at the receiver's end. ANS: The frame is 10011101. The generator is 1001. The message after appending three zeros is 10011101000. The remainder on dividing 10011101000 by 1001 is 100. So, the actual bit string transmitted is 10011101100 (Frame +Reminder) The received bit stream with an error in the third bit from the left is 10111101100. Dividing this by 1001 produces a remainder 100, which is different from zero. Thus, the receiver detects the error and can ask for a retransmission. 35

Exercise What is the remainder obtained by dividing x^7 + x^5 + 1 by the generator polynomial x^3 + 1? Ans: 111 36

Checksum ~ It is also based on the concept of redundancy(vrc, LRC, CRC, checksum.) 37

Checksum Generator n bits All 0 s 38

The sender follows these steps: The unit is divided into K sections, each of n bits. All sections are added using ones complement to get the sum. The sum is complemented and becomes the checksum. The checksum is sent with the data. The receiver follows these steps: The unit is divided into k sections, each of n bits. All sections are added using one s complement to get the sum with checksum bits. The sum is complemented. If the result is zero, the data are accepted: 39 otherwise, rejected

Data unit and Checksum 40

Example : ( at a sender) Original data : 10101001 00111001 10101001 00111001 -------------11100010Sum 00011101Checksum 10101001 00111001 00011101 41

( at a receiver) Received data : 10101001 00111001 00011101 10101001 00111001 00011101 --------------11111111 Sum 00000000 Complement 42

Now suppose there are burst error that affects 4 bits so the receiving data Received data : 10101111 11111001 00011101 10101111 11111001 00011101 --------------1 11000101 1 carry 11000110 Sum 00111001 Complement 43

Example Calculate the checksum of two data by adding 11100011 & 10011100 using 1 s complement and verify it from sender side. 44

Error Correction ~ can be handled in two ways: sender retransmit the entire data unit. use an error-correcting code by receiver Single-Bit Error Correction parity bit The task of error correction is to locate the invalid bit or bits 45

Hamming Code ~ developed by R.W.Hamming Positions of redundancy bits Hamming code in 46

m is total number of bits in data and r is required redundancy bit. So, the total number of bits in a transmittable unit is m+r, Relationship between data and redundancy bits r 2 m+r+1 ex) For value of m is 7, the smallest r value that can satisfy this equation is 4 24 7 + 4 + 1 16>12 47

Each r bit is the VRC bit for one combination of data bits r1 r2 r4 r8 = = = = bits 1, 3, 5, 7, 9, 11 bits 2, 3, 6, 7, 10, 11 bits 4, 5, 6, 7 bits 8, 9, 10, 11 Position r1: check 1 bit, skip 1 bit, check 1 bit, skip 1 bit, etc. (1,3,5,7,9,11,13,15,...) Position r2: check 2 bits, skip 2 bits, check 2 bits, skip 2 bits, etc. (2,3,6,7,10,11,14,15,...) Position r4: check 4 bits, skip 4 bits, check 4 bits, skip 4 bits, etc. (4,5,6,7,12,13,14,15,20,21,22,23,...) Position r8: check 8 bits, skip 8 bits, check 8 bits, skip 8 bits, etc. (815,24-31,40-47,...) Position r16: check 16 bits, skip 16 bits, check 16 bits, skip 16 bits, etc. (16-31,48-63,80-95,...) Position r32: check 32 bits, skip 32 bits, check 32 bits, skip 32 bits, etc. (32-63,96-127,160-191,...) 48

Hamming Code 49

Hamming Code 50

Hamming Code 51

Example of Hamming Code 52

Single-bit error 53

Error Detection 54

Practice Question: 1. 2. 3. 4. Construct Hamming code for 1010101. Construct the Hamming code for the bit sequence 10011101. Sixteen-bit messages are transmitted using a Hamming code. How many check bits are needed to ensure that the receiver can detect and correct single bit errors? Show the bit pattern transmitted for the message 1101001100110101. Assume that even parity is used in the Hamming code. If there is an error at the 9th bit from the left at the receiver side then check whether at the receiver side it is identified or not. Receiver receive the code 11001100111.When it uses the Hamming encoding algorithm, the result is 0101.Which bit is in error? What is the correct code. 55

Flow Control Flow control is a set of procedures that tells the sender how much data it can transmit before it must wait for an acknowledgement from the receiver. Since the rate of processing is often slower than the rate of transmission, receiver has a block of memory (buffer) for storing incoming data until they are processed. 56

Error control: Error control in the data link layer is based on automatic repeat request (ARQ), whenever an error is detected, specified frames are retransmitted. Flow and Error control Methods: The process is called Automatic Repeat request (ARQ) Stop-and-Wait ARQ Sliding window schemes: Go-Back-N ARQ Selective Repeat ARQ 57

Stop-and-Wait In this the sender sends one frame and wait for an acknowledgement before sending the next frame. The sender set the timer for receiving the ack. Both data and ack are numbered alternatively 0 and 1. The receiver sends only positive ack, otherwise live silent. Sender has control variable 58 S and receiver has control variable R.

Stop and Wait ARQ Advantage: It is simple. Each frame is checked and acknowledged before next frame is sent. 59

Stop-and-Wait ARQ, Damaged frame When a receiver receives a damaged frame, it discards it, sit silent and keeps its value of R. After the timer at the sender expires, another copy of frame 1 is sent. 60

Stop-and-Wait, lost ACK frame If the sender receives a damaged ACK, it discards it. When the timer of the sender expires, the sender retransmits frame 1. Receiver has already received frame 1 and expecting to receive frame 0 (R=0). Therefore it discards the second copy of frame 1. 61

Stop-and-Wait, delayed ACK frame The ACK can be delayed at the receiver due to some problem It is received after the timer for frame 0 has expired. Sender retransmitted a copy of frame 0. However, R =1 means receiver expects to see frame 1. Receiver discards the duplicate frame 0. Sender receives 2 ACKs, it discards the second ACK. Numbering is required for each frame. 62

Piggybacking A method to combine a data frame with ACK. Station A and B both have data to send. Instead of sending separately, station A sends a data frame that includes an ACK. Station B does the same thing. Piggybacking saves bandwidth. 63

Sliding Window: Basics Allows multiple frames to be in transit at the same time before needing an ACK. Receiver allocates buffer space for n frames. The sliding window is a imaginary box at both the sender and receiver end. Transmitter is allowed to send n (window size) frames without receiving ACK. 64

Sequence Numbers Frames from a sender are numbered sequentially. Setting of a limit is needed to include the sequence number of each frame in the header. If the header of the frame allows m bits for sequence number, the sequence numbers range from 0 to 2 m 1. for m = 3, sequence numbers are: 0,1, 2, 3, 4, 5, 6, 7. The window size will be 2 m 1 We can repeat the sequence number. 0, 1, 2, 3, 4, 5, 6, 7, 0, 1, 2, 3, 4, 5, 6, 7, 0, 1... 65

Sliding Window: Receiver Receiver ack s frame by including sequence number of next expected frame. Cumulative ACK: ack s multiple frames. Example: if receiver receives frames 2,3, and 4, it sends an ACK with sequence number 5, which ack s receipt of 2, 3, and 4. 66

Transmission window shrinks each time as frame is sent, and grows each time an ACK is received. The receiver window shrinks when data are received and expands when ACK are sent. Example-1:If the sequence of transmission for 7 bit frame is as follow : window size 7 ->data0 ->data1 <-ack2 ->data2 <-ack3 ->data3 ->data4 ->data5 <-ack6 67

Sliding Window Example 68

Sliding Window Example 69

Sender Sliding Window At the sending site, to hold the outstanding frames until they are acknowledged, we use the concept of a window. The size of the window is at most 2m -1 where m is the number of bits for the sequence number. Size of the window can be variable, e.g. TCP. The window slides to include new unsent frames when the correct ACKs are received 70

Receiver Sliding Window Size of the window at the receiving site is always 1 in this protocol. Receiver is always looking for a specific frame to arrive in a specific order. Any frame arriving out of order is discarded and needs to be resent. Receiver window slides as shown in fig. Receiver is waiting for frame 0 in part a. 71

Control Variables Sender has 3 variables: S, SF, and SL S holds the sequence number of recently sent frame SF holds the sequence number of the first frame SL holds the sequence number of the last frame Receiver only has the one variable, R, that holds the sequence number of the frame it expects to receive. If the seq. no. is the same as the value of R, the frame is accepted, otherwise rejected. 72

Go Back N- ARQ Receiver sends positive ACK if a frame arrived safe and in order. If the frames are damaged/out of order, receiver is silent and discard all subsequent frames until it receives the one it is expecting. The silence of the receiver causes the timer of the unacknowledged frame to expire. Then the sender resends all frames, beginning with the one with the expired timer. For example, suppose the sender has sent frame 6, but the timer for frame 3 expires (i.e. frame 3 has not been acknowledged), then the sender goes back and sends frames 3, 4, 5, 6 again. Thus it is called Go-Back-N-ARQ The receiver does not have to acknowledge each frame received, it can send one cumulative ACK for several frames. Sender can send up to W frames before worrying about ACKs. 73

Go-Back-N ARQ, normal operation The sender keeps track of the outstanding frames and updates the variables and windows as the ACKs arrive. 74

Go-Back-N ARQ, lost frame Frame 2 is lost When the receiver receives frame 3, it discards frame 3 as it is expecting frame 2 (according to window). After the timer for frame 2 expires at the sender site, the sender sends frame 2 and 3. (go back to 2) 75

Go-Back-N ARQ, damaged/lost/delayed ACK If an ACK is damaged/lost, we can have two situations: If the next ACK arrives before the expiration of any timer, there is no need for retransmission of frames because ACKs are cumulative in this protocol. Example ACK1, ACK2, and ACk3 are lost, ACK4 covers them if it arrives before the timer expires. If ACK4 arrives after time-out, the last frame and all the frames after that are resent. A delayed ACK also triggers the resending of frames 76

Go-Back-N ARQ, sender window size Size of the sender window must be less than 2 m. Size of the receiver is always 1. If m = 2, window size = 2 m 1 = 3. Fig compares a window size of 3 and 4. Accepts as the 1st frame in the next cycle-an 77 error

Selective Repeat ARQ, sender and receiver windows Go-Back-N ARQ simplifies the process at the receiver site. Receiver only keeps track of only one variable, and there is no need to buffer out-of-order frames, they are simply discarded. However, Go-Back-N ARQ protocol is inefficient for noisy link. It s bandwidth is inefficient and slows down the transmission. In Selective Repeat ARQ, the size of window of sender and receiver is almost same. only the damaged frame is resent. More bandwidth efficient but more complex processing at receiver. It defines a negative ACK (NAK) to report the sequence number of a damaged frame before the timer expires. 78

Selective Repeat ARQ, lost frame Frames 0 and 1 are accepted when received because they are in the range specified by the receiver window. Same for frame 3. Receiver sends a NAK2 to show that frame 2 has not been received and then sender resends only frame 2 and it is accepted as it is in the range of the window. 79

Selective Repeat ARQ, sender window size Size of the sender and receiver windows must be at most one-half of 2 m. If m = 2, window size should be 2 m /2 = 2m-1 = 2. Fig compares a window size of 2 with a window size of 3. Window size is 3 and all ACKs are lost, sender sends duplicate of frame 0, window of the receiver expect to receive frame 0 (part of the window), so accepts frame 0, as the 1st frame of the next cycle an error. 80

THANK YOU