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

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

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

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

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

DATA LINK LAYER UNIT 7.

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.

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

The Data Link Layer Chapter 3

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

CSCI-1680 Link Layer I Rodrigo Fonseca

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

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

Error Detection Codes. Error Detection. Two Dimensional Parity. Internet Checksum Algorithm. Cyclic Redundancy Check.

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

CSE 461: Framing, Error Detection and Correction

Introduction to Computer Networks. 03 Data Link Layer Introduction

CS422 Computer Networks

Links. CS125 - mylinks 1 1/22/14

Data Link Layer. Overview. Links. Shivkumar Kalyanaraman

Chapter 3. The Data Link Layer

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

CS 3640: Introduction to Networks and Their Applications

CSE 123: Computer Networks

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

INF Data Communication Data Link Layer

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.

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

Data Link Layer. Srinidhi Varadarajan

CSCI-1680 Link Layer Reliability Rodrigo Fonseca

CSCI-1680 Link Layer Reliability John Jannotti

Networking Link Layer

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

Links Reading: Chapter 2. Goals of Todayʼs Lecture. Message, Segment, Packet, and Frame

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

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

Inst: Chris Davison

The Data Link Layer Chapter 3

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

Data Link Layer Overview

Data Link Layer Overview

Data Link Control Protocols

CS 455/555 Intro to Networks and Communications. Link Layer

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

Data Link Layer Overview

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

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

Data Link Layer Overview

The Link Layer and LANs. Chapter 6: Link layer and LANs

Chapter 5 Link Layer and LANs

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

CS 4453 Computer Networks Winter

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

ERROR AND FLOW CONTROL. Lecture: 10 Instructor Mazhar Hussain

Data Link Layer: Overview, operations

COMPUTER NETWORKS UNIT-3

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

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

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

Data Link Layer (1) Networked Systems 3 Lecture 6

Lecture 5: Data Link Layer Basics

1/29/2008. From Signals to Packets. Lecture 6 Datalink Framing, Switching. Datalink Functions. Datalink Lectures. Character and Bit Stuffing.

4. Error correction and link control. Contents

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

(Refer Slide Time: 2:20)

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

CSC 401 Data and Computer Communications Networks

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

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

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

NETWORK PROBLEM SET Solution

CSC 4900 Computer Networks: The Link Layer

ECE 4450:427/527 - Computer Networks Spring 2017

Chapter 3 The Data Link Layer

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

CIS 551 / TCOM 401 Computer and Network Security. Spring 2007 Lecture 7

Link layer, LANs: outline. Chapter 5-1 Link Layer. Link layer: introduction. Link layer services

Computer Networking : Principles, Protocols and Practice

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

Your favorite blog : (popularly known as VIJAY JOTANI S BLOG..now in facebook.join ON FB VIJAY

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

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

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

C08a: Data Link Protocols

Chapter 11 Data Link Control 11.1

Communication Networks. Part I

CS/ECE 438: Communication Networks for Computers Spring 2018 Midterm Examination Online

UNIT I FUNDAMENTALS & LINK LAYER

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

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

Solutions for Chapter similar to 1 and 3

Computer and Network Security

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

Lecture 6 Datalink Framing, Switching. From Signals to Packets

Analyzation of Automatic Repeat Request (ARQ) Protocols

CPE 448/548 Exam #1 (100 pts) February 14, Name Class: 448

Link Layer and LANs 안상현서울시립대학교컴퓨터 통계학과.

5th Slide Set Computer Networks

CHANNEL CODING 1. Introduction

UNIT IV -- TRANSPORT LAYER

Transcription:

Department of Computer and IT Engineering University of Kurdistan Data Communication Netwotks (Graduate level) Data Link Layer By: Dr. Alireza Abdollahpouri

Data Link Layer 2

Data Link Layer Application Presentation Session Transport Network Data Link Physical Function: Send blocks of data (frames) between physical devices Regulate access to the physical media Key challenge: How to delineate frames? How to detect errors? How to perform media access control (MAC)? How to recover from and avoid collisions? 3

Adaptors Communicating datagram sending node frame adapter link layer protocol frame adapter receiving node link layer implemented in adaptor (NIC) Ethernet card, PCMCI card, 802.11 card sending side: encapsulates datagram in a frame adds error checking bits, rdt, flow control, etc. receiving side looks for errors, rdt, flow control, etc extracts datagram, passes to receiving node adapter is semiautonomous link & physical layers 4

Hop-to-hop delivery 5

Link-Layer Services Service provided by the data link layer for network layer: Unacknowledged connectionless service Acknowledged connectionless service Acknowledged connection-oriented service 6

Link-Layer Duties Framing Encapsulating packet into frame, adding header, trailer Using MAC addresses, rather than IP addresses Error detection and/or correction Errors caused by signal attenuation, noise. Receiver detecting presence of errors Receiver correcting errors without retransmission Flow control Pacing between adjacent sending and receiving nodes Media access control (MAC) Pacing between adjacent sending and receiving nodes 7

Framing 8

Framing Break sequence of bits into a frame Typically implemented by the network adaptor 10110101000011001.1000100110101010101 How to define the borders? 9

Byte Counting (character count) 132 132 Data Sender: insert length of the data in bytes at the beginning of each frame Receiver: extract the length and read that many bytes what if the count field gets corrupted? 10

Byte Oriented: Byte stuffing START DLE DLE Data DLE END END Add START and END sentinels to the data Problem: what if END appear in the data? Add a special DLE (Data Link Escape) character before END What if DLE appears in the data? Add DLE before it. Used by Point-to-Point protocol, e.g. modem, DSL, cellular 11

Bit Oriented: Bit Stuffing 01111110 Data 01111110 Add sentinels to the start and end of data Both sentinels are the same Example: 01111110 in High-level Data Link Protocol (HDLC) Sender: insert a 0 after each 11111 in data Known as bit stuffing Receiver: after seeing 11111 in the data 111110 remove the 0 (it was stuffed) 111111 look at one more bit 1111110 end of frame 1111111 error! Discard the frame Disadvantage: 20% overhead at worst 12

Bit Stuffing- example 13

Physical Layer Coding Violations Only applicable if physical layer coding has some redundancy The combinations of low-low and high-high which are not used for data may be used for marking frame boundaries. e.g., in Manchester coding 14

Error Control 15

Transmission Errors Transmission errors are caused by: Thermal noise {Shannon} impulse noise (e..g, arcing relays) signal distortion during transmission (attenuation) crosstalk voice amplitude signal compression (companding) quantization noise (PCM) jitter (variations in signal timings) receiver and transmitter out of synch. 16

Packet corruption Types of errors: single bit; only 1 bit in the data unit has changed less likely burst error; 2 or more bits in the data unit have changed Example: 0.01 s of burst impulse noise 1200 bps data rate 12 bits of errors 17

Error Detection Error detection Transmit extra (redundant) information Use redundant information to detect errors Extreme case: send two copies of the data Trade-off: accuracy vs. overhead Techniques for detecting errors Parity checking Checksum Cyclic Redundancy Check (CRC) 18

Error detection Redundancy: adding extra bits for detecting errors at the destination 19

Error detection techniques 20

Parity bits Idea: add extra bits to keep the number of 1s even Example: 7-bit ASCII characters + 1 parity bit 0101001 1 1101001 0 1011110 1 0001110 1 0110100 1 Detects 1-bit errors and some 2-bit errors Not reliable against bursty errors 21

Two Dimensional Parity Parity bit for each column 0101001 1101001 1011110 0001110 0110100 1011111 1 0 1 1 1 0 1111011 0 Parity bit for each row Parity bit for the parity byte Can detect all 1-, 2-, and 3-bit errors, some 4-bit errors 14% overhead 22

Two Dimensional Parity Examples 0101001 1101001 1011110 0001110 1 1 0110100 1011111 1 0 1 1 1 0 1111011 0 0101001 1101001 1011110 0001110 1 0110100 1011111 1 0 1 1 1 0 1111011 0 Odd number of 1s Odd Number of 1s Odd number of 1s Odd Number of 1s 23

Two Dimensional Parity Examples 0101001 1101001 1 0 1011110 0001110 1 1 0110100 1011111 1 0 1 1 1 0 1111011 0 0101001 1101001 1 1011110 0001110 1 1 0110100 1011111 1 0 1 1 1 0 1111011 0 Odd number of 1s Cannot be detected Odd number of 1s 24

Error detection techniques 25

Checksums Idea: Add up the bytes in the data Include the sum in the frame START Data Checksum END Use ones-complement arithmetic Lower overhead than parity: 16 bits per frame But, not resilient to errors Why? 0101001 + 1101001= 10010010 1 0 Used in UDP, TCP, and IP 26

Checksum Example: IP header 1. The data unit is divided into k sections, each of n bits 2. All sections are added using 1 s complement 3. The sum is complemented 4. The checksum is sent with data 27

1 s complement Suppose the following block of 16 bits is to be sent using a checksum of 8 bits. 10101001 00111001 The numbers are added using one s complement 10101001 00111001 ------------ Sum 11100010 Checksum 00011101 The pattern sent is 10101001 00111001 00011101 28

Checksum (cnt d) Performance Can we use this technique to detect an error if 2 corresponding opposite bits in 2 data segments become corrupted? An example: Transmitted sequence: 10101001 00111001 00011101 Received sequence: 00101001 10111001 00011101 29

Error detection techniques 30

Cyclic Redundancy Check (CRC) Uses field theory to compute a semi-unique value for a given message Much better performance than previous approaches Fixed size overhead per frame (usually 32-bits) Quick to implement in hardware Only 1 in 2 32 chance of missing an error with 32-bit CRC Details are in the book/on Wikipedia 31

Cyclic Redundancy Check (CRC) Represent a (n+1)-bit message as an n-degree polynomial M(x) E.g., 10101101 M(x) = x 7 + x 5 + x 3 + x 2 + x 0 Choose a divisor k-degree polynomial G(x) Compute reminder R(x) of M(x)*x k / G(x), i.e., compute A(x) such that M(x)*x k = A(x)*G(x) + R(x), where degree(r(x)) < k Let T(x) = M(x)*x k R(x) = A(x)*G(x) Then T(x) is divisible by G(x) 32

CRC check Based on binary division CRC added to the data unit so that the resulting data becomes exactly divisible by a predetermined number CRC exactly 1 less bit than the divisor 1. A string of n zeros added to the data unit 2. New data divided by divisor 3. Replace 0 s by CRC 33

CRC generator Modulo-2 division 34

CRC generator (cnt d) Name Polynomial Application CRC-8 x 8 + x 2 + x + 1 ATM header CRC-10 x 10 + x 9 + x 5 + x 4 + x 2 + 1 ATM AAL ITU-16 x 16 + x 12 + x 5 + 1 HDLC 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 LANs 35

CRC performance CRC can detect 1. all burst errors that affect odd number of bits 2. all burst errors of length degree of polynomial 3. with high probability burst errors > degree of polynomial Example: CRC-12 (degree of 12) 1. OK 2. OK 3. 99.97 % 36

Error correction 1. By retransmission flow and error control protocols 2. Forward Error Correction (FEC) require more redundancy bits should locate the invalid bit or bits n-bit code word contains m data bits + r redundancy bits n=m+r m r m+r+1 bits discoverable by r bits r Code-word Example: 2 m + r +1 For m=5 data bits can r be 3? 37

Hamming distance The Hamming distance is the number of bits that have to be changed to get from one bit pattern to another. Example: 10010101 & 10010011 have a hamming distance of 2 For any coding whose members have a Hamming distance of two, any one bit error can be detected. Why? 38

Hamming distance (a) A code with poor distance properties (b) A code with good distance properties o o o o x x x x x o o o x x o o o o o x o o o x o x o o x o o x o x o o o x x = codewordso = non-codewords 39

Error detection/correction To detect d single bit errors, you need a d+1 code distance. To correct d single bit errors, you need a 2d+1 code distance. In general, the price for redundant bits is too expensive to do error correction for network messages. Network protocols use error detection and ARQ. 40

Hamming code Example: 7-bit ASCII code + 4 bit redundancy Each r bit is the parity bit for one combination of data bits r1: bits: 1, 3, 5, 7, 9, 11 r2: bits: 2, 3, 6, 7, 10, 11 r3: bits 4, 5, 6, 7 r4: bits 8, 9, 10, 11 2 0 1 1 1 1 1 1 2 1 2 2 2 2 2 2 2 2 4 4 4 4 2 3 8 8 8 8 Σ Σ Σ Σ Σ Σ Σ Σ Σ Σ Σ 1 2 3 4 5 6 7 8 9 10 11 41

Hamming code (cnt d) Example of redundancy bit calculation (even parity) 42

Hamming code (cnt d) Error detection using Hamming code once the bit is identified the receiver can reverse its value 43

Flow Control 44

Flow Control The process of managing the rate of data transmission between two nodes to prevent a fast sender from overwhelming a slow receiver Transmission Link Buffer 45

Categories of Flow Control 46

Stop-and-Wait Automatic Repeat request Simplest flow and error control mechanism The sending device keeps a copy of the last frame transmitted until it receives an acknowledgement identification of duplicate transmission (lost or delayed ACK) A damaged or lost frame is treated in the same way Timers introduced Positive ACK sent only for frames received safe & sound 47

A Simplex Stop-and-Wait ARQ 1. Normal operation 2. The frame is lost 3. The ACK is lost 4. The ACK is delayed 48

Stop-and-Wait ARQ(Normal operation) The sender will not send the next piece of data until it is sure that the current one is correctly received sequence number necessary to check for duplicated packets No NACK when packet is corrupted duplicate ACKs instead 49

Stop-and-Wait ARQ(Lost or damaged frame) roundtrip time + processing in the receiver Should be as short as possible. Why? 50

Stop-and-Wait ARQ (Lost ACK) Importance of frame numbering Numbering frames prevents the retaining of duplicate frames 51

Stop-and-Wait ARQ (Delayed ACK) Importance of ACK numbering Numbered acknowledgments are needed if an acknowledgment is delayed and the next frame is lost. 52

Duplex Stop-and-Wait ARQ Piggybacking combine data with ACK (less overhead saves bandwidth) 53

Performance of Stop-and-wait ARQ RTT d trans = (Frame size)/bandwidth d ptop = (Speed of signal)/ (Channel length) Utilization = d trans /( d trans + 2 d prop ), error free case or Utilization = (1-P E )d trans /( d trans + 2 d prop, ) error case 54

Stop-and-wait operation Example: 1 Gbps link, 15 ms prop. delay, 8000 bit frame: first bit transmitted, t = 0 last bit transmitted, t = L / R sender receiver RTT first bit arrives last bit arrives, send ACK ACK arrives, send next frame, t = RTT + L / R very low d trans = R L = 8000bits 10 bps 9 = 8microseconds U sender = L / R RTT + L / R =.008 30.008 = 0.00027 55

Sliding window (Pipelined) protocols Pipelining: sender allows multiple, in-flight, yet-to-beacknowledged frames range of sequence numbers must be increased buffering at sender and/or receiver Two generic forms of pipelined protocols: Go-Back-N, Selective repeat 56

Sliding Window Protocols Sequence numbers sent frames are numbered sequentially number of frames stored in the header if the number of bits in the header is m than sequence number goes from 0 to 2 m -1 Sliding window to hold the unacknowledged outstanding frames frame sequence number acknowledged frames 57

Question What is the consequence of the window size in the receiver on the order of the received packets? Answer: Window size 1 means that the packets are received in order This is not the case for the larger window size 58

Sliding Window: Retransmission Strategies How to deal with errors? If the ACK is not received then the sender must go back and retransmit earlier frames (from the lost frame) (Go-Back-N) Sender only retransmits frames for which a NAK is received (the lost or corrupted frames) (Selective repeat) 59

Go-back-N (Control variables) S- holds the sequence number of the recently sent frame SF holds sequence number of the first frame in the window SL holds the sequence number of the last frame R sequence number of the frame expected to be received 60

The name of Go-back-N: why? Re-sending frame when the frame is damaged the sender goes back and sends a set of frames starting from the last one ACKn d the number of retransmitted frames is N Example: The window size is 4. A sender has sent frame 6 and the timer expires for frame 3 (frame 3 not ACKn d). The sender goes back and re-sends the frames 3, 4, 5 and 6. 61

Go-back-N (normal operation) How many frames can be transmitted without acknowledgment? ACK1 not necessary if ACK2 is sent expected sequence number 62

Go-back-N (damaged or lost frame) damaged frames are discarded! Why are correctly received packets not buffered? What is the disadvantage of this? 63

Go-back-N (sender window size) sequence number 64

Go-back-N (drawback) Inefficient all out of order received packets are discarded This is a problem in a noisy link many frames must be retransmitted -> bandwidth consuming Solution re-send only the damaged frames Selective Repeat ARQ avoid unnecessary retransmissions 65

Selective Repeat ARQ Processing at the receiver more complex The window size is reduced to 2 m-1 (at most) Both the transmitter and the receiver have the same window size Receiver expects frames within the range of the sequence numbers 66

Selective Repeat ARQ (lost frame) 67

Selective Repeat 68

Selective Repeat ARQ (sender window size) 69

Sliding window- analysis Frame transmission time is normalized to a value of 1; thus, the propagation time is a. 70

Sliding window- analysis The throughput on the line depends on both the window size W and the value of a 71

Sliding window- utilization Error free channel a =d prop /d trans Selective repeat with error Go-back-N with error Assume a frame is in error with probability P 72

Sequence number and window size Transmitter window size Receiver window size How many sequence numbers required? Stop-and-wait ARQ 1 1 2 Go-back-N W 1 1+W Selective repeat W W 2W In SR protocol with the window size of 5, how many bits required to numbering the sequence of frames? 2*5=10 sequence numbers, we need 4 bits 73

Stop-and-wait utilization (example) A channel has a bit rate of 4 kbps and a propagation delay of 20 ms. For what range of frame sizes does Stopand-Wait give an efficiency (link utilization) > 50%? Efficiency will be 50% when the time to transmit the frame equals the roundtrip propagation delay. At a transmission rate of 4 bits/ms, 160 bits takes 40 ms. For frame sizes above 160 bits, stop and wait is reasonably efficient. 74

Sliding window utilization (example) A 3000 km long T1 trunk is used to transmit 64 byte frame s using selective-repeat protocol. If the propagation speed is 6 µsec/km, how many bits should the sequence numbers be? To operate efficiently, the sequence space (actually, the send window size) must be large enough to allow the transmitter to keep transmitting until the first acknowledgement has been received. The propagation time is 18 ms. At T1 speed, which is 1.536 Mbps (excluding the 1 header bit), a 64 byte frame takes 0.300 msec. Therefore, the first frame fully arrives 18.3 msec after its transmission was started. The acknowledgement takes another 18 msec to get back, plus a small (negligible) time for the acknowledgement to arrive fully. In all, this time is 36.3 msec. The transmitter must have enough window space to keep going for 36.3 msec. A frame takes 0.3 ms, so it takes 121 frames to fill the pipe. Seven bit sequence numbers are needed 75

Questions 76