Data Link Layer: Overview, operations

Similar documents
Links. CS125 - mylinks 1 1/22/14

1-1. Switching Networks (Fall 2010) EE 586 Communication and. November 8, Lecture 30

Outline. Introduction to Networked Embedded Systems - Embedded systems Networked embedded systems Embedded Internet - Network properties

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

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

ECE 4450:427/527 - Computer Networks Spring 2017

Chapter 5 Link Layer and LANs

Data Link Layer: Multi Access Protocols

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

CSC 4900 Computer Networks: The Link Layer

Inst: Chris Davison

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

Physical Layer. Medium Access Links and Protocols. Point-to-Point protocols. Modems: Signaling. Modems Signaling. Srinidhi Varadarajan

Chapter 5: Link layer

Goals of Today s Lecture. Adaptors Communicating

CMPE 150/L : Introduction to Computer Networks. Chen Qian Computer Engineering UCSC Baskin Engineering Lecture 16

Lecture 8 The Data Link Layer part I. Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

CS 43: Computer Networks. 27: Media Access Contd. December 3, 2018

Message, Segment, Packet, and Frame Link-layer services Encoding, framing, error detection, transmission control Error correction and flow control

Topics. Link Layer Services (more) Link Layer Services LECTURE 5 MULTIPLE ACCESS AND LOCAL AREA NETWORKS. flow control: error detection:

CS 43: Computer Networks Media Access. Kevin Webb Swarthmore College November 30, 2017

Lecture 6. Data Link Layer (cont d) Data Link Layer 1-1

Chapter 5 Link Layer. Computer Networking: A Top Down Approach. 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012

Lecture 8 Link Layer: functionality, error detection, media access algorithm

Multiple Access Links and Protocols

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

CSC 401 Data and Computer Communications Networks

Chapter 5 Link Layer and LANs

MULTIPLE ACCESS PROTOCOLS 2. 1

Computer Networks. Today. Principles of datalink layer services Multiple access links Adresavimas, ARP LANs Wireless LANs VU MIF CS 1/48 2/48

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

Adaptors Communicating. Link Layer: Introduction. Parity Checking. Error Detection. Multiple Access Links and Protocols

Broadcast Links, Addressing and Media Access Control. Link Layer B. Link and Physical Layers. MAC Addresses

Lecture 6 The Data Link Layer. Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

CMPE 150: Introduction to Computer Networks

CC451 Computer Networks

transferring datagram from one node data-link layer has responsibility of to adjacent node over a link 5-1 TDTS06 Computer networks

Chapter V: Link Layer

CS 3516: Computer Networks

Link Layer and LANs. Our Goals. Link Layer

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

Adaptors Communicating. Link Layer: Introduction. Parity Checking. Error Detection. Multiple Access Links and Protocols

CSCD 330 Network Programming

Computer Network Fundamentals Spring Week 3 MAC Layer Andreas Terzis

Redes de Computadores. Medium Access Control

Lecture 5 The Data Link Layer. Antonio Cianfrani DIET Department Networking Group netlab.uniroma1.it

Chapter 5 Link Layer and LANs

Chapter V: Link Layer

Chapter 4 Network Layer

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

Lecture 19. Principles behind data link layer services Framing Multiple access protocols

Computer Networks Medium Access Control. Mostafa Salehi Fall 2008

CSCD 330 Network Programming Fall 2012

Medium Access Control in Wireless Sensor Networks

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

High Level View. EE 122: Ethernet and Random Access protocols. Medium Access Protocols

CS 4453 Computer Networks Winter

Links. COS 461: Computer Networks Spring Mike Freedman h?p://

Multiple Access Protocols

Medium Access Control in Wireless IoT. Davide Quaglia, Damiano Carra

Module 10 Data Link Layer CS655! 10-1!

EE 122: Ethernet and

SC250 Computer Networking I. Link Layer. Prof. Matthias Grossglauser LCA/I&C.

Links Reading: Chapter 2

Master Course Computer Networks IN2097

CS 3640: Introduction to Networks and Their Applications

Chapter 6: Link layer and LANs. Link layer, LANs: outline. Link layer: introduction. Link layer: context. Link layer services (more)

Medium Access Control in Wireless Sensor Networks

Master Course Computer Networks IN2097

Problem Set Name the 7 OSI layers and give the corresponding functionalities for each layer.

Getting Connected (Chapter 2 Part 4) Networking CS 3470, Section 1 Sarah Diesburg

Your Future?! Links and LANs! Regrading of Homework! Other Announcements! Goals of Todayʼs Lecture! Link-Layer Services!

CSE 461: Multiple Access. Homework: Chapter 2, problems 1, 8, 12, 18, 23, 24, 35, 43, 46, and 58

Chapter 5: DataLink Layer

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

Module 4 Data Link Layer CS655! 4-1!

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

DATA LINK LAYER UNIT 7.

Link Layer and LANs. CMPS 4750/6750: Computer Networks

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

Chapter 5 Link Layer. Computer Networking: A Top Down Approach. 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012

Lecture 3: Data Link. (A. Pattavina, Chapter 4 and 15) Ilenia Tinnirello

Chapter 6 The Link Layer and LANs

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

CCM 4300 Lecture 6 Computer Networks, Wireless and Mobile Communications. Dr Shahedur Rahman. Room: T115

CSCI-1680 Link Layer I Rodrigo Fonseca

Medium Access Control

Chapter 6 Medium Access Control Protocols and Local Area Networks

Reminder: Datalink Functions Computer Networking. Datalink Architectures

Lecture / The Data Link Layer: Framing and Error Detection

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

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

CSC 8560 Computer Networks: Link Layer

Lecture 9: Bridging. CSE 123: Computer Networks Alex C. Snoeren

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

Introduction to Computer Networks. 03 Data Link Layer Introduction

Physical and Data Link layers

Lecture 7: Flow & Media Access Control"

Chapter 5 Link Layer. Computer Networking: A Top Down Approach. 6 th edition Jim Kurose, Keith Ross Addison-Wesley March 2012

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.

Transcription:

Data Link Layer: Overview, operations Chapter 3 1 Outlines 1. Data Link Layer Functions. Data Link Services 3. Framing 4. Error Detection/Correction. Flow Control 6. Medium Access 1

1. Data Link Layer Functions Provides a well-defined service interface to the network layer. Determines how the bits of the physical layer are grouped into frames (framing). Deals with transmission errors (CRC and ARQ). Flow control: regulates the flow of frames. Performs general link layer management. (seq #, protocols, address etc) 3 Outlines 1. Data Link Layer Functions. Data Link Services 3. Framing 4. Error Detection/Correction. Flow Control 6. Medium Access 4

. Data Link Services Network layer has bits, Says to data link layer: send these to this other network layer, Data link layer sends bits to other data link layer, Other data link layer passes them up to network layer. Packets Network Layer Packets A Data link Layer Physical Layer Frames Data link Layer Physical Layer B.1. Types of Services Acknowledged/Unacknowledged Receiver returns acknowledgement (ACK) for each transmitted frame. Connection oriented/connectionless Setup a logical connection before transmitting frames. 6 3

Outlines 1. Data Link Layer Functions. Data Link Services 3. Framing 4. Error Detection/Correction. Flow Control 6. Medium Access 7 3. Framing Data link breaks physical layer stream of bits into frames...010110100101001101010010... The data unit at the data link layer is the frame, Issues: 1. Frame creation. Frame delineation How does receiver detect boundaries? 8 4

3.1. Frame Creation network layer data unit: Packet Network Layer one-to-one mapping Data Link Layer frame boundaries control information Data link layer data unit: Frame 9 3.1. Frame Creation (cont d) Network Layer Data Link Layer 10

3.. Frame Delineation How to tell when a new frame starts: Character count Frame tags with character stuffing Frame tags with bit stuffing 11 3.. Frame Delineation Delineation by character count Control Field containing character count Character count lists the number of characters in the data field of the frame Problem: corrupted control fields 1 6

3.. Frame Delineation Frame tagging with character stuffing Frame tags Use starting and ending characters (tags) to mark boundaries of frame. Problem: What if tag character occurs in the data or control portions of the frame? 13 3.. Frame Delineation Character stuffing Insert extra escape characters when a tag appears in data field DLE STX Start Tag DLE ETX End Tag DLE DLE Character Stuffed DLE code 14 7

3.. Frame Delineation Character Stuffing Example I am a DLE jerk trying to DLE ETX crash your network! Character Stuffing DLE STX I am a DLE DLE jerk trying to DLE DLE ETX crash your network! DLE ETX Character Unstuffing I am a DLE jerk trying to DLE ETX crash your network! 1 3.. Frame Delineation Frame tagging with bit stuffing Bit strings may be used instead of character sequences to delineate frames More efficient 16 8

3.. Frame Delineation Bit stuffing Each frame begins with a start and end bit sequence, e.g., 01111110 When sender s data link layer sees five 1 s in a row, it stuffs a zero bit The receiver unstuffs a zero after five consecutive 1 s. At the sender: 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0 1 1 1 1 1 0 0 17 3.. Frame Delineation Bit Stuffing Example 00110010111111100010100 Bit Stuffing 0111111000110010111110110001010001111110 Bit Unstuffing 00110010111111100010100 18 9

Outlines 1. Data Link Layer Functions. Data Link Services 3. Framing 4. Error Detection/Correction. Flow Control 6. Medium Access 19 4. Error Detection/Correction No physical link is perfect Bits will be corrupted We can either: detect errors and request retransmission or correct errors without retransmission 0 10

4. Error Detection/Correction 1. Original data (k bits). Sender: apply error control technique Insertion/field addition (n bits) 3. Receiver: receives message recalculates 4. Comparison: received and recalculated 1 4.1. Error Detection Parity bit technique Append a single parity bit to a sequence of bits. If using odd parity, the parity bit is chosen to make the total number of 1 s in the bit sequence odd. If even parity, the parity bit makes the total number of 1 s in the bit sequence even. Example: Transmitted Sequence Parity Parity Bit 00010101 even 01111 even 11111111 odd 10011 odd 1 0 1 0 11

3.. Error Control Polynomial Codes Can detect errors on large chunks of data, Has low overhead, More robust than parity bit, Requires the use of a code polynomial, Example: x + 1 3 3.. Error Control Cyclic Redundancy Check CRC: Example of a polynomial code Procedure (at the sender): 1. Let r be the degree of the code polynomial C(x). (Both sender and receiver know the code polynomial) Append r zero bits to the end of the message bit string. Call the entire bit string S(x).. Divide S(x) by the code polynomial C(x) using modulo division. 3. Subtract the remainder from S(x) using modulo subtraction. (call resulting polynomial t(x).) 4. Transmit the checksummed message t(x). 4 1

3.. Error Control Background S(x) = f(x)c(x) + remainder S(x) - remainder = f(x)c(x) = t(x) sender transmits t(x) note that t(x) is divisible by C(x) if the received sequence at the receiver is not divisible by C(x), error has occurred 3.. Error Control Generating a CRC : Example Message: 1011 1 x x 3 + 0 x x + 1 x x 1 + 1 x x 0 MSB LSB Most Significant Bit Low Significant Bit Code Polynomial C(x): x + 1 (101) = x 3 + x + 1 Step 1: Compute S(x) r = S(x) = 101100 (x + x 3 + x ) 6 13

3.. Error Control Generating a CRC Example (cont d) Step : Modulo divide C(x) 101 1001 101100 S(x) 101 001 000 010 000 100 101 01 Remainder 7 3.. Error Control Generating a CRC Example(cont d) Step 3: Modulo subtract the remainder from S(x) 101100-01 101101 Checksummed Message t(x) 8 14

3.. Error Control Procedure (at the receiver) Divide the received message by the code polynomial C(x) using modulo division. If the remainder is zero, there is no error detected. 9 Decoding a CRC Example 101101 Checksummed message 1011 Original message (if there are no errors) 1001 C(x) 101 101101 101 001 000 010 000 101 101 00 Received message Remainder = 0 (No error detected) 30 1

Outlines 1. Data Link Layer Functions. Data Link Services 3. Framing 4. Error Detection/Correction. Flow Control 6. Medium Access 31. Flow Control A B If A sends at a faster rate than B can receive, bits will be lost We need flow control! 3 16

Some Flow Control Algorithms Simplex protocols : Stop and Wait Data only flows in one direction Acknowledgement stream may flow in the other direction Full duplex protocols Sliding window with Go Back N Sliding window with Selective Repeat 33.1. Stop-and-Wait A B A sends data A sends more data B sends ACK The receiver sends an acknowledgement frame telling the sender to transmit the next data frame. The sender waits for the ACK, and if the ACK comes, it transmits the next data frame. 34 17

.1. Stop-and-Wait What if the frame will be lost? The sender waits the acknowledgement within a timeout delay and then retransmits again the same frame. What if the ACK will be lost? The sender waits the acknowledgement within a timeout delay and then retransmits again the same frame. The receiver discard the duplicated frame (seq nb) and send again the same ACK. 3.. Windowed Flow Control A B A sends packets 1,, 3 B sends ACK for 1, A sends packets 4, B sends ACK for 3, 4, 36 18

.. Full Duplex Flow Control Protocols Data frames are transmitted in both directions Sliding Window Flow Control Protocols 37..1. Sliding Window Protocols: Definitions Sequence Number: Each frame is assigned a sequence number that is incremented as each frame is transmitted Sender s Window: Keeps sequence numbers of frames that have been sent but not yet acknowledged Sender Window size: The number of frames the sender may transmit before receiving ACKs Receiver s Window: Keeps sequence numbers of frames that the receiver is allowed to accept Receiver Window size: The maximum number of frames the receiver may receive out of order 38 19

..1. Sliding Window Protocols: General Remarks The sending and receiving windows do not have to be the same size Any frame which falls outside the receiving window is discarded at the receiver Unlike the sender s window, the receiver s window always remains at its initial size 39... Simple Sliding Window (Window Size = ) A sliding window with a maximum window size of frames Acknowledged frame Transmitted frame Received frames 6 1 6 1 4 3 Sender 4 3 Receiver Expected frames Window for a 3-bit sequence number (000=0, 001=1,010= 7) 40 0

Sliding Window example (w=1) 6 Sender window 1 6 Receiver window 1 (a) (b) (c) (d) (a) Initial state, no frames transmitted (b) Sender transmits frame 0 (c) Receiver receives frame 0 and ACKs (d) Sender receives ACK This protocol behaves identically to stop and wait. 41 Sliding Window with Window Size W With a window size of 1, the sender waits for an ACK before sending another frame. With a window size of W, the sender can transmit up to W frames before being blocked. 4 1

Sender-Side Window (window Size W=) 6 1 (a) (b) (c) (d) 6 1 (e) (f) (g) (h) (a) Initial window state (b) Send frame 0 (c) Send frame 1 (d) ACK for frame 0 arrives (e) Send frame (f ) ACK for frame 1 arrives (g) ACK for frame arrives, send frame 3 (h) ACK for frame 3 arrives 43 Receiver-Side Window (Window Size W=) 6 1 (a) (b) (c) (d) 6 1 4 3 4 3 (e) (f) (g) (h) (a) Initial window state (b) Nothing happens (c) Frame 0 arrives, ACK frame 0 (d) Nothing happens 4 3 (e) Frame 1 arrives, ACK frame 1 (f) Frame arrives, ACK frame (g) Nothing happens (h) Frame 3 arrives, ACK frame 3 4 3 44

What about Errors? What if a data or acknowledgement frame is lost when using a sliding window protocol? Two Solutions: Go Back N Selective Repeat 4 What about Errors? Cont d One very important note about acknowledgement Ack for frame n = I am expecting frame n+1 (not I received fame n ) 46 3

Sliding Window with Go Back N When the receiver notices a missing or erroneous frame, it simply discards all frames with greater sequence numbers and sends no ACK The sender will eventually time out and retransmit all the frames in its sending window 47.3. Go Back N timeout interval sender 0 1 3 4 6 7 8 3 4 6 7 8 9 10 receiver 0 1 E D D D D D D 3 4 6 7 8 9 10 discarded by receiver frame with error Time 48 4

.3. Go Back N (cont d) Go Back N can recover from erroneous or missing packets But It is wasteful. If there are a lot of errors, the sender will spend most of its time retransmitting useless information 49.4. Sliding Window with Selective Repeat The sender retransmits only the frame with errors The receiver stores all the correct frames that arrive following the bad one. (Note that this requires a significant amount of buffer space at the receiver.) When the sender notices that something is wrong, it just retransmits the one bad frame, not all its successors. 0

.4. Selective Repeat timeout interval sender 0 1 3 4 6 7 8 9 10 11 1 13 14 receiver 0 1 E 3 4 6 7 8 9 10 11 1 13 14 frame with error Time 1.4. Selective Repeat: a variant timeout interval sender 0 1 3 4 6 7 8 9 10 11 1 13 14 receiver 0 1 E 3 4 6 7 8 9 10 11 1 13 14 frame with error Time 6

.4. Selective Repeat: cont d In this scheme, every time a receiver receives a frame, it sends an acknowledgement which contains the sequence number of the next frame expected 3 Outlines 1. Data Link Layer Functions. Data Link Services 3. Framing 4. Error Detection/Correction. Flow Control 6. Medium Access 4 7

9. Medium Access Many users typically share a single link or a single medium How do you give them all access? 9.1. Possible Media Broadcast or shared channels Point-to-point links 6 8

9.. Multiple Access Protocols If more than one host sends at the same time, there is a collision Need algorithm to share the channel: Multiple access protocol distributed algorithm that determines how nodes share channel, i.e., determine when node can transmit 7 9.. MAC Protocols: a taxonomy Three broad classes: Channel Partitioning divide channel into smaller pieces (time slots, frequency, code) allocate piece to node for exclusive use Random Access channel not divided, allow collisions recover from collisions Taking turns Nodes take turns, but nodes with more to send can take longer turns 8 9

9..1. Channel Partitioning MAC protocols (Fixed Assignment Schemes) Example: Time Division Multiple Access (TDMA) It allows several users to share the same frequency channel by dividing the signal into different time slots. The users transmit one after the other using his own time slot. frame (n) frame (n+1) host 1 3 4 1 time Channel capacity is assigned even to users who have nothing to send 9 9..1. Channel Partitioning MAC protocols: TDMA TDMA: time division multiple access access to channel in "rounds, each station gets fixed length slot (length = pkt trans time) in each round, unused slots go idle, example: 6-station LAN, 1,3,4 have pkt, slots,,6 idle. inefficient with low duty cycle users and at light load. 60 30

frequency bands 10/1/011 9..1. Channel Partitioning MAC protocols: FDMA FDMA: frequency division multiple access channel spectrum divided into frequency bands each station assigned fixed frequency band unused transmission time in frequency bands go idle example: 6-station LAN, 1,3,4 have pkt, frequency bands,,6 idle 1 3 4 6 61 9... Random Access Protocols When node has packet to send transmit at full channel data rate R. no a priori coordination among nodes two or more transmitting nodes collision, Random Access MAC protocol specifies: how to detect collisions how to recover from collisions (e.g., via delayed retransmissions) Examples of random access MAC protocols: slotted ALOHA ALOHA CSMA, CSMA/CD, CSMA/CA 6 31

Slotted ALOHA Assumptions all frames same size time is divided into equal size slots, time to transmit 1 frame nodes start to transmit frames only at beginning of slots nodes are synchronized if or more nodes transmit in slot, all nodes detect collision Operation when node obtains fresh frame, it transmits in next slot no collision, node can send new frame in next slot if collision, node retransmits frame in each subsequent slot with prob. p until success 63 Slotted ALOHA Pros single active node can continuously transmit at full rate of channel highly decentralized: only slots in nodes need to be in sync simple Cons collisions, wasting slots idle slots nodes may be able to detect collision in less than time to transmit packet clock synchronization 64 3

CSMA (Carrier Sense Multiple Access) CSMA: listen before transmit: If channel sensed idle: transmit entire frame If channel sensed busy, defer transmission Human analogy: don t interrupt others! 6 CSMA/CD (Collision Detection) Send when you have a packet to send. If collision, retransmit Example: Ethernet 1 3 4 Listen before transmission if busy, wait if idle, transmit Listen during transmission if collision, abort and retransmit 66 33

CSMA/CD (Collision Detection) CSMA/CD: carrier sensing, deferral as in CSMA collisions detected within short time colliding transmissions aborted, reducing channel wastage Collision Detection: easy in wired LANs: measure signal strengths, compare transmitted, received signals difficult in wireless LANs: receiver shut off while transmitting human analogy: the polite conversationalist 67 9..3. Taking Turns MAC protocols Polling: master node invites slave nodes to transmit in turn concerns: polling overhead latency single point of failure (master) Token passing: control token passed from one node to next sequentially. token message concerns: token overhead latency single point of failure (token) 68 34