Chapter 4 Data Link Layer

Similar documents
Random Access. 1. Aloha. 2. Slotted Aloha 3. CSMA 4. CSMA/CD

Chapter 6 Medium Access Control Protocols and Local Area Networks

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

LANs. Local Area Networks. via the Media Access Control (MAC) SubLayer. Networks: Local Area Networks

Chapter 12 Multiple Access 12.1

CHAPTER 7 MAC LAYER PROTOCOLS. Dr. Bhargavi Goswami Associate Professor & Head Department of Computer Science Garden City College

Multiple Access Protocols

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

ECEN 5032 Data Networks Medium Access Control Sublayer

Multiple Access. Data Communications and Networking

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

Aloha and slotted aloha

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

CSE 461: Multiple Access Networks. This Lecture

Computer Network Fundamentals Spring Week 3 MAC Layer Andreas Terzis

Links. CS125 - mylinks 1 1/22/14

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

Data Link Layer: Collisions

Chapter 4. The Medium Access Control Sublayer. Points and Questions to Consider. Multiple Access Protocols. The Channel Allocation Problem.

CMPE 257: Wireless and Mobile Networking

Data Link Layer: Overview, operations

Multiple Access (1) Required reading: Garcia 6.1, 6.2.1, CSE 3213, Fall 2010 Instructor: N. Vlajic

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

LECTURE PLAN. Script. Introduction about MAC Types o ALOHA o CSMA o CSMA/CD o CSMA/CA

Jaringan Komputer. Broadcast Network. Outline. MAC (Medium Access Control) Channel Allocation Problem. Dynamic Channel Allocation

Redes de Computadores. Medium Access Control

Chapter 6 Medium Access Control Protocols and Local Area Networks

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

ECE 4450:427/527 - Computer Networks Spring 2017

ICE 1332/0715 Mobile Computing (Summer, 2008)

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

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

Chapter 5 Link Layer and LANs

Local Networks. Lecture 4 6-Apr-2016

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

Contention Protocols and Networks

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

Wireless Communications

Random Assignment Protocols

COS 140: Foundations of Computer Science

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

Multiple Access Links and Protocols

The Medium Access Control Scheme (MAC Layer) Reference: Andrew S. Tanenbaum, Computer Networks, 3rd Edition, Prentice Hall, 1996.

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

Goals. Fundamentals of Network Media. More topics. Topics. Multiple access communication. Multiple access solutions

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

LAN PROTOCOLS. Beulah A AP/CSE

Local Area Networks (LANs) SMU CSE 5344 /

CS 4453 Computer Networks Winter

Chapter 5 Data-Link Layer: Wired Networks

Markov Chains and Multiaccess Protocols: An. Introduction

CSC 4900 Computer Networks: The Link Layer

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

CSC 401 Data and Computer Communications Networks

EE 122: Ethernet and

Lecture 4: Wireless MAC Overview. Hung-Yu Wei National Taiwan University

COMMUNICATION NETWORKS NETW 501

IEEE , Token Rings. 10/11/06 CS/ECE UIUC, Fall

Mobile Communications Chapter 3 : Media Access

Reminder: Datalink Functions Computer Networking. Datalink Architectures

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

Data Communications. Automatic Repeat Request Medium Access Control

Medium Access Control Sublayer

Link Layer: Retransmissions

Data Link Layer -2- Network Access

Access Technologies! Fabio Martignon

Medium Access Control. IEEE , Token Rings. CSMA/CD in WLANs? Ethernet MAC Algorithm. MACA Solution for Hidden Terminal Problem

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

Medium Access Control

Data and Computer Communications. Chapter 13 Wireless LANs

Goals of Today s Lecture. Adaptors Communicating

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

Data Link Layer -2- Network Access

EITF25 Internet Techniques and Applications L4: Network Access. Stefan Höst

ECE453 Introduction to Computer Networks. Broadcast vs. PPP. Delay. Lecture 7 Multiple Access Control (I)

COS 140: Foundations of Computer Science

CS 716: Introduction to communication networks. - 9 th class; 19 th Aug Instructor: Sridhar Iyer IIT Bombay

Media Access Control in Ad Hoc Networks

ECE 158A: Lecture 13. Fall 2015

Chapter 5: Link layer

Computer and Network Security

Medium Access Control. MAC protocols: design goals, challenges, contention-based and contention-free protocols

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

Data Link Layer, Part 3 Medium Access Control. Preface

MULTIPLE ACCESS PROTOCOLS 2. 1

CSE 461: Wireless Networks

Data and Computer Communications. Chapter 11 Local Area Network

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

Medium Access Control

Computer Networks Medium Access Control. Mostafa Salehi Fall 2008

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

COMP/ELEC 429/556 Introduction to Computer Networks

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

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

Data and Computer Communications

MAC Sublayer(1) Principal service of the Medium Access Control Sublayer: Allocating a single broadcast channel (mostly a LAN) among competing users

Media Access Control. Networked Systems (H) Lecture 5

Link Layer and Ethernet

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

Multiple Access Communications. EEE 538, WEEK 11 Dr. Nail Akar Bilkent University Electrical and Electronics Engineering Department

Transcription:

Chapter 4 Data Link Layer

Data Link Layer Objectives: understand principles behind data link layer services: error detection and correction ( by the receiver) reliable data transfer link access by sharing a broadcast channel: multiple access Instruct nodes when to transmit ( MAC protocols)

Data link layer The data link layer implements an error free packet delivery service between nodes that are attached to the same physical layer. 1. It frames the packet into a specific format at the sending node and extracts the packet at the receiving node. 2. It supervises the resulting packet delivery. Retransmission is requested if errors are detected. The header contains the physical address of the most recent node and the next intended node. The trailer contains error control information.

Error Control Methods Digital transmission systems introduce errors Errors occur due to noise and/or interference on a communication channel, e.g., Bit Error Rate (BER) = 10-7 Types of errors: Single bit error: one bit per frame has an error Multiple bit error: two or more non-consecutive bits have errors Burst error: two or more consecutive bits have errors

Error Control Methods Error Correction Errors Detection and Retransmission

Error Correction Error Correction: the packets contain independent information called an error correction code for the receiver to be able to correct the erroneous packet. Error correction must be used when it is not possible to retransmit erroneous packets (delay sensitive traffic=real time traffic). A simple error correction coding method is repetition code: to send every packet (bits) 3 times and the receiver uses a majority vote on each bit. 1 1 1 1 1 1 0

Error Correction Without repetition code, the error rate is just the bit error rate (BER). With repetition code, the error rate is: 3 2 3 1 BER BER BER 2 3BER For an N-bit packet, the probability that at least one of the N bits is received incorrectly two or three times. PER is packet error rate. PER 1 1 N N N 1 1N

Error Detection and Retransmission Error detection means adding extra bits for detecting errors at the destination. If there is error, the receiver arranges for the transmitter (sender) to send another copy of the same packet by using the retransmission protocol for supervising the retransmission.

Vertical Redundancy Check (VRC) A redundant bit called a parity bit is appended to every data packet unit so that the total number of ones becomes either even or odd. Both the sending and receiving systems must use the same type of parity. If an even parity unit is transmitted and an odd parity unit is received, the data unit won t be accepted.

Vertical Redundancy Check (VRC) Generating function checks all the bit 1 s. If the number of bit 1 s is an odd number, add bit 1 ; an even number, add bit 0. The receiver puts the entire frame through a check function. If the received bit stream passes the checking criteria, the data portion is accepted and the redundant bit is discarded. Reliability: VRC can detect all single-bit errors. It can detect multiple or burst errors only if the total number of errors is an odd number. It is the most common and least expensive mechanism for error detection.

Cyclic Redundancy Code (CRC) CRC has been used by almost all communication networks. It is based on binary division. In CRC, instead of adding bit together to achieve a desired parity, a sequence of redundant bits, called the CRC or the CRC remainder, is appended to the end of a data unit so that the resulting data unit (frame) becomes exactly divisible by a predetermined binary number. To be valid, a CRC must have two qualities: it must have exactly one less bit than the divisor, and appending it to the end of the data string must make the resulting bit sequence exactly divisible by the devisor.

Cyclic Redundancy Code (CRC) The redundancy bits used by CRC are derived by dividing the data unit by the predetermined divisor; the remainder is the CRC.

Cyclic Redundancy Check (CRC) view data bits, D, as a binary number choose r+1 bit generator G (leftmost and rightmost bits are both 1) Append r bit 0 to D Then, Divide it by G. The remainder is CRC code (r bits). Send <D,R> codes to the receiver The receiver divides the received bit sequence by G If non-zero remainder: error detected! However, a remainder of zero means: i. no error; ii. error cannot be detected

CRC Example: D = 101110 G = 1001 All CRC calculations are done in modula-2 arithmetic without carries in addition or borrows in subtraction, which is equivalent to bitwise exclusive-or (XOR) 1 XOR 1 = 0 0 XOR 0 = 0 1 XOR 0 = 1 0 XOR 1 = 1 The leading zero of the remainder (for each step) is dropped off When the leftmost bit of the remainder is zero, use 0000 instead of the original divisor. Transmitted frame: 1 0 1 1 1 0 0 1 1

Cyclic Redundancy Check (CRC) Reliability: CRC will detect all possible errors except those that change the bit value by exactly the value of the divisor. Popular CRC divisors, use 13, 17 and 33 bits bringing the likelihood of an undetected error to almost zero. The CRC generator (the divisor) is most often represented not as a string of 1 s and 0 s but as an algebraic polynomial, so that it is readily implemented using shift-register circuit. It also provides a more compact framework and can be used to mathematically prove the concept.

Cyclic Redundancy Check (CRC) The algebraic polynomial is called polynomial code. We treat a k-bit frame as polynomial with coefficients of 0 and 1 only with terms from X k-1 to X 0 e.g., 110001 : 1 X 5 + 1 X 4 + 0 X 3 + 0 x 2 +0 X 1 + 1 x 0 = x 5 + x 4 + 1 Standard polynomial of divisor: CRC-12 (13 bits): G(X)=x 12 + x 11 + x 3 +x+ 1 1100000001011 CRC-16 (17 bits): G(X) = x 16 + x 15 + x 2 + 1

Cyclic Redundancy Check (CRC) At the sender, the message is represented by m bits. m1 m2 0... U x U x U x U x U j 0,1 j0,..., m1 T(x) m1 m2 0 The generator polynomial has degree r or has (r+1) bits. r r 1 G x g x g x... g r For a binary divisor: r1 0 g0 g r 1 U(x) is appended with r zeros. 1 2 xu x U x U x... U x n = m + r r n n r m1 m2 0 Divide X r U(x) by G(x) to obtain the remainder: r xu x G x Q x C x where Q(x) is the quotient. Add C(x) to X r U(x) in order to get the codeword T(x) r x U x C x G xqx

Cyclic Redundancy Check (CRC) On the receiver side: T x T x E x If there are no errors then Divide T x by ^ ^ G x E x 0 Due to noise and ISI 1. If the remainder 0, then E(x) 0 2. If the remainder = 0, then G x E x which implies: a. E(x) = 0, there is no error, or b. E(x) 0, but G(x) / E(x), there is an undetected error

Cyclic Redundancy Check (CRC) The data is 1100 and the generator polynomial G(x) = x 3 + x + 1 = 1011. Find CRC bits? quotient 1 0 1 1 1 1 1 0 1 1 0 0 0 0 0 1 0 1 1 1 1 1 0 1 0 1 1 1 0 1 0 1 0 1 1 0 0 1 0 0 0 0 0 divisor x 3 x 1 6 5 x x x 6 x x 5 5 x x 4 4 x x x x 3 3 3 3 x 2 x 2 4 2 x x x 4 x 2 x dividend x x 0 1 0 remainder

Properties of CRC 1. All single bit errors can be detected. For a single bit error, E(x) = x i, 0<=i<=n-1, n=m+r. Note that each error in the frame (codeword) corresponds to a non-zero coefficient in E(x). In other words; x i indicates an error occurs at the i+1 th bit. Since G(x) has at least two nonzero terms (x r and 1) r r1 1 G x x g x... g x 1 r1 1 E(x) must have at least two nonzero terms in order to be divided by G(x). Therefore, for single bit errors, G x E x, i.e., the error can be detected.

Properties of CRC 2. Double bit errors (two isolated single bit errors) separated by k-1 bits, can be detected if G x x k 1 j i i k 1, E x G x x k 1 G x x k 1 Since E x x x x x k j iand Then, G x if 3. Single burst errors of length k <= r can be detected. Burst length refers to the number of bit positions from the first error to the last error inclusive. Burst errors of length k can be given by From 1, Gx x i i k 1 x x... 1 If k-1 < degree of G(x) (i.e., k <= r), then G(x) can never divide E(x)

Properties of CRC 4. The probability that a burst error of length r+1 is undetected is, (assuming all error patterns are equally likely). Let 2 -(r-1) i r r1 E x x x er 1x... e1x1 e 0,1, 0 im1 where i e g,..., e g G x E x if and only if: r1 r1 1 1 Since there are 2 r-1 equally likely patterns, the probability of undetected burst errors of length r+1 is 2 -(r-1)

Stop-and-Wait Protocol Retransmission in the data link layer is based on automatic repeat request (ARQ). All retransmission protocols are based on the same mechanisms: timers and acknowledgements. Stop and wait protocol: the basic idea is to ensure that each packet has been received correctly before initiating the transmission of the next packet d NAK packet "0" τ f time to transmit 1 packet d propagation delay τ a time to transmit an ACK/NCK packet S = τ d + τ f + 2d round trip delay T>=S bound of time out S: the time between sending packet and receiving acknowledgement)

Stop-and-Wait Protocol The sender appends a sequence number to each packet. The sequence number can be alternating 0 and 1. The sender transmits a packet and waits for up to T seconds for acknowledgement. ACK is received by sender, send frame 1 NAK is received by sender, send frame 0 No ACK/NAK after T seconds, resend frame 0 The receiver also appends a corresponding sequence number to each ACK/NAK packet.

Stop-and-Wait Protocol Frame received correctly, but ACK undergoes loss - after time-out period, sender resends frame - receiver receives the same frame twice Frames must be numbered so that receiver can recognize and discard duplicate frames - sequence # are included in packet header - only 1 bit required ( 0 and 1 )

Stop-and-Wait Protocol ACKs can be delayed due to problems with links or network congestion, then sender resends frame. When delayed ACK arrives, sender assumes that given ACK is for the last frame sent ACKs must be numbered to prevent gaps in delivered packet sequence (1 bit required)

Stop-and-Wait Protocol Efficiency: the average rate at which the protocol sends correct packets divided by the channel transmission rate. It depends on the actual delay of the acknowledgement and the packet error rate. Let X be the time between transmission of packet n and that of packet (n+1). X is a random variable. 1/ E X f Efficiency = 1/ E X No error: efficiency = Let (1- ρ) represent the probability of packet error. Let ρ represent the probability of no packet error. E X S 1 T E X 1 E X S T SWP f f E X S 1 / T Advantages: Simple Disadvantages: Low efficiency f

Go Back N (GBN) Protocol N is called the window size. T N f The sender first transmits packets 0, 1, 2,, N-1 and waits for each of their acknowledgements. As soon as the sender gets the ACK with sequence number 0, it transmits packet N and so on. If packet P undergoes transmission errors, the receiver ignores packet P and all subsequent packets (P+1, P+2, ). The sender is then forced to go back N packets and begin re-transmitting all packets from P onwards.

Go Back N (GBN) Protocol No errors: if S N, for every S seconds, the sender f transmits N packets, N f GBN S If S N f, then the sender keep on sending packets and the efficiency is 100%. N f Therefore, GBN min 1, S If there are packet errors: GBN f E X Where X is the time between transmission of packet n and that of packet n+1. Let ρ be the probability of no packet error,

Go Back N (GBN) Protocol The average transmission time E[X] per packet is: f 1 E X S E X EX [ ] f 1 S Assume that S = T = Nτ f, i.e., the duration of the timeout T equals to the round-trip delay S. In this way, the sender gets the ACK or NAK or Time-out of the first packet when it has transmitted N packets. GBN f 1 E X N

Local Area Networks and Medium Access Control Protocols A local area network (LAN) is a data communication system that allows a number of independent devices to communicate directly with each other in a limited geographic area. Area diameter few km Data rate = several Mbps Owned by a single organization LANs are broadcast networks. A single transmission medium is shared by a community of users. All information is received by all users. LANs are also called multiple access networks (with low-cost and simplicity). The medium access control (MAC) protocols are to coordinate the access to the channel so that information gets through from a source to a destination in the same broadcast network.

In 1985, the Computer Society of the IEEE started a project, called Project 802, to set up standards so that LAN equipments manufactured by different companies is compatible. Project 802 divides the data link layer into sub-layers: Logical link control (LLC) Media access Control Medium Access Control LAN compared with the OSI model

The LLC is the upper sublayer and is same for all LANs. Its functions include error detection and retransmission. The MAC sublayer coordinates the data link tasks within a specific LAN. The MAC sublayer is manufacturer-specific and dependent on the LAN type. For LANs specified by project 802 are following: Ethernet (802.3) Token bus (802.4) Token ring (802.5) Medium Access Control Wireless LANs (802.11)

Sharing a transmission medium Medium Access Control Static sharing (channelization schemes) is a collision-free sharing Dynamic sharing (MAC schemes) minimizes the incidence of collision Medium sharing techniques Static channelization Dynamic medium access control scheduling Random access Random access methods constitute the first major class of MAC procedures

ALOHA random access scheme It was developed at the University of Hawaii in the early 1970s to connect computers situated on different Hawaiian islands. The computers of the ALOHA network transmit on the same radio channel whenever they have a packet to transmit. From time-to-time packet transmission will collide, but these can be treated as transmission errors, and recovery can take place by retransmission. When traffic is very light, the probability of collision is very small, and so retransmissions need to be carried out infrequently. ALOHA scheme requires stations to use a random retransmission time. (This randomization is intended to spread out the retransmission and reduces the likelihood of additional collisions between stations. ) ALOHA is the father of multiple access protocols.

ALOHA network f 1 Transmission rate 9600bps f 0 f 0 f f 0 1 407MHz 413MHz f 1 ALOHA is a packet-switched radio communication network that was invented by Norm Abrahmson at the University of Hawaii in the early 1970s. Ethernet is its direct descendant.

1. Protocol Pure ALOHA (unslotted ALOHA) A user transmits whenever it has packets to transmit When two or more packet transmissions overlap in time, a collision occurs and all the packets involved in the collision are destroyed. (non-capture) If ACK not received within timeout, then a user picks random backoff time (to avoid repeated collision) User retransmits packet after backoff time

Analysis (Throughput and delay) 1. Definitions and assumptions 1. X: packet transmission time (assume constant) 2. S: throughput (average # successful packet transmissions per X seconds) 3. G: load (average # transmission attempts per X sec) 4. Traffic traffic (new arrivals + retransmissions) is a Poisson process with rate G packet/slot 2. The probability of a successful transmission is the probability that they are no additional packet transmission in the vulnerable period. t0 X t0 t 0 X

Analysis (Throughput and delay)

Analysis (Throughput and delay) S 0.2 0.18 0.16 0.14 0.12 0.1 0.08 0.06 0.04 0.02 0 1/ 2e 0.184 0 0.0078125 0.015625 0.03125 0.0625 0.125 G 0.25 0.5 1 2 Throughput S versus load G for pure ALOHA 4 S reaches a peak value of 1/2e at G=0.5, and then declines back toward 0. For a given value of S, say, S=0.05, there are two associated values of G. For small G, S G. For large G, there are many backlogged users. ALOHA system cannot achieve throughput higher than 18.4 percent (1/2e).

The average (delay) number of transmission attempts/packet is G/S=e 2G attempts per packet The avergae number of unsuccessful attempts per packet is =G/S-1=e 2G -1 The first transmission requires X+t prop seconds, and each subsequent retransmission requires 2t prop +X+B, where B is the average backoff time and t prop is the one way propagation delay. Thus the average packet transmission time is approximately given by Express delay in multiples of X E[T aloha ]=X+t prop +(e 2G -1)(X+2t prop +B) E[T aloha ]/X=1+a+(e 2G -1)(1+2a+B/X) Where a=t prop /X is the one way normalized propagation delay. If the backoff time is uniformly distributed between 1 and K packet transmission times, then B=(K+1)X/2

Slotted ALOHA Slotted ALOHA is to constrain the user to transmit in synchronized fashion. All users keep track of transmission slots and are allowed to initiate transmission only at the beginning of a time slot (the time axis is divided into time slots with durations equal to the time to transmit a packet) Only packets that arrive during prior X seconds collide.

Throughput of Slotted ALOHA S GP[no collision] GP[no arrivals in X seconds] ( G) G 0! 0 e G G e G 0.4 0.35 0.368 S 0.3 0.25 0.2 0.184 Ge -G 0.15 0.1 0.05 Ge -2G 0 0.015625 0.03125 0.0625 0.125 0.25 G 0.5 1 2 4 8

S max =1/e=36.8% Efficiency=throughput 36.8% (upper bound=36.8%) The average packet delay in slotted ALOHA E[T slotted-aloha ]/X=1+a+(e G -1)(1+2a+B/X) Example ALOHA and Slotted ALOHA Suppose that a radio system uses a 9600 bps channels for sending call setup request messages to a base station. Suppose that packets are 120 bits long, that the timeout is 20ms, and that the backoff is uniformly distributed between 1 and 7. What is the maximum throughput possible with ALOHA and slotted ALOHA? Compare the average delay in ALOHA and slotted ALOHA when the load is 40 percent of the maximum possible throughput of the ALOHA system.

The system transmits packets at a rate of 9600 bits/second x 1 packet/120bits = 80 packets/second. The maximum throughput for ALOHA is then 80 x 0.184 1 15 packets/second. The maximum throughput for slotted ALOHA is then 30 packets/second. The load at 40 percent of the maximum of the ALOHA system is 15 0.40 = 6 packets/second. G is expressed in packet arrivals/packet transmission time, therefore, G=6/80. Assuming that the propagation delay is negligible, the average packet delay for ALOHA in multiples of X is then 1+(e 12/80-1)(1+(1+7)/2)=1.81 packet transmission time. The slotted ALOHA system with a load of 6 packets/second 1+(e 6/80-1)(1+(1+7)/2)=1.39 packet transmission time.

... Application of Slotted ALOHA cycle... Reservation mini-slots X-second slot Reservation protocol allows a large number of stations with infrequent traffic to reserve slots to transmit their packets in future cycles Each cycle has mini-slots allocated for making reservations Stations use slotted ALOHA during mini-slots to request slots

Carrier Sense Multiple Access with Collision Detection The access mechanism used in an Ethernet is called CSMA/CD, standardized in IEEE 802.3 CSMA/CD is the result of an evolution from multiple access (MA) to carrier sense multiple access (CSMA), and finally, to CSMA/CD. In MA, there was no provision for traffic coordination. In a CSMA system, any user (work station) wishing to transmit must first listen to the existing traffic on the line. A device listens by checking for a voltage. No voltage means the line is idle. CSMA cuts down on the number of collisions but does not eliminate them. In CSMA/CD system, the station listens again after each packet transmission. The extremely high voltages indicate a collision.

Carrier Sensing Multiple Access (CSMA) A station senses the channel before it starts transmission If busy, either wait or schedule backoff (different options) If idle, start transmission Vulnerable period is reduced to t prop (due to channel capture effect) When collisions occur they involve entire frame transmission times If t prop >X, no gain compared to ALOHA or slotted ALOHA Station A begins transmission at t = 0 A (another station) BS Station A captures channel at t = t prop A

CSMA Options Transmitter behavior when busy channel is sensed 1-persistent CSMA (most greedy) Start transmission as soon as the channel becomes idle Low delay and low efficiency Non-persistent CSMA (least greedy) Wait a backoff period, then sense carrier again High delay and high efficiency p-persistent CSMA (adjustable greedy) Wait till channel becomes idle, transmit with prob. p; or wait one t prop time & re-sense with probability 1-p Delay and efficiency can be balanced (spread out the transmission attempts) Sensing

Throughput versus load G for 1-persistent (three different a=t prop /X ) 1-Persistent CSMA S 0.6 0.5 0.4 0.3 0.53 0.45 An analysis of the throughput S versus load G for CSMA is beyond the scope of this text. 0.01 0.2 0.1 0.16 0.1 0 0.0 0.0 0.0 0.125 0.25 0.5 The normalized propagation delay a = t prop /X has a significant impact on the maximum achievable throughput since t prop constitutes the vulnerable period. 1 2 4 8 16 1 32 64 G

Throughput versus load G for non-persistent (three different a=t prop /X ) S 0.9 0.8 0.81 Non-Persistent CSMA 0.7 0.6 0.5 0.51 0.01 0.4 0.3 0.2 0.1 0 0.0 0.0 0.0 0.125 0.25 0.5 0.14 1-persistent is sharper than non-persistent. a=t prop /X has import impact on the throughput. When a approaches 1, both 1-persistent and non-persistent is worse than ALOHAs. 1 2 4 8 1 16 32 64 G 0.1

Analysis of CSMA/CD protocol In CSMA/CD protocol, a node with a packet to transmit must proceed as follows: 1. Wait until the channel is idle; 2. When the channel is idle, transmit and listen while transmitting 3. In case of a collision, stop the packet transmission, and then wait for a random delay and go to (1). Note: when a node goes back to (1) after its waiting time, it senses the signal from the other nodes and must then wait until the end of that transmission before transmitting. In CSMA, collisions result in wastage of X seconds spent transmitting an entire frame CSMA-CD reduces wastage of time (or bandwidth) to detect collision and abort transmission

CSMA/CD reaction time A begins to transmit at t = 0 A detects collision at t= 2 t prop - A B B begins to transmit at A A B B t = t prop - ; B detects collision at t = t prop It takes 2 t prop to find out if channel has been captured (The reaction time in CSMA-CD is 2t prop )

Efficiency (throughput): The nodes attempt to transmit at discrete times, in time slots with a duration of 2t prop each. The slot duration of 2t prop is used to guarantee that, if nodes select to transmit at the beginning of two different slots, then they can t collide. Let be the probability that during a given time slot there is no collision and that one node starts transmitting. Let N (N 2) nodes compete for a time-slotted channel by transmitting packets with probability p, independently of one another, in any given time slot.

Efficiency (throughput): Let A be the average number of time slots that are wasted before a successful transmission A=0 + (1-)(1+A) ) A= -1-1 First time slot is successful With =0.4 A=1.5 slots First time slot is wasted where is the time to transmit a packet.

Throughput for Random Access MACs 1 CSMA/CD 1-P CSMA max 0.8 0.6 (throughput) 0.4 0.2 Non-P CSMA Slotted ALOHA ALOHA 0 0.01 0.1 1 a For small a: CSMA-CD has best throughput For larger a: Aloha & slotted Aloha better throughput

Carrier Sense Multiple Access with Collision Avoidance (CSMA-CA) For WiFi, transmit signal is MUCH stronger than received signal High path loss in the wireless environment (up to 100dB) Impossible to listen while transmitting because you will drown out anything you hear Also transmitter may not even have much of a signal to detect due to geometry

Carrier Sense Multiple Access with Collision Avoidance (CSMA-CA) Procedure Similar to CSMA but instead of sending packets, control frames are exchanged Sender asks receiver whether it is able to receive a transmission - Request to Send (RTS) Receiver agrees, sends out a Clear to Send (CTS) Sender sends, receiver Acknowledgements (ACKs)

Hidden Terminal Problem A B C D Problem -C is transmitting a frame to B. - A is unaware of C s Tx. -Now, if A transmits, A s Tx will collide with C s at B The above problem is due to C being hidden from A. Hidden means being far away

CSMA-CA solving Hidden Terminal Problem Advantages Small control frames lessen the cost of collisions (when data is large) RTS + CTS provide virtual carrier sense which protects against hidden terminal collisions (where A can t hear C) A C Disadvantages Not as efficient as CSMA-CD

Exposed Terminal Problem A B C D Tx Problem -A is transmitting a frame to D. -B knows that someone is transmitting. - If B transmits a frame to C, no problem. However, B does not want because it is unaware of D s location. The above problem is due to B being exposed to A s Tx.

CSMA-CA solving Exposed Terminal Problem When node B hears an RTS from a neighboring node A, but not the corresponding CTS, node B can deduce that it is an exposed terminal and is permitted to transmit to other neighboring nodes.

Random Contention Access Slotted contention period Used by all carrier sense variants Provides random access to the channel Operation Each node selects a random back off number Waits that number of slots monitoring the channel If channel stays idle and reaches zero then transmit If channel becomes active wait until transmission is over then start counting again

802.11 Contention Window Random number selected from [0,cw] Small value for cw Less wasted idle slots time Large number of collisions with multiple senders (two or more stations reach zero at once) Optimal cw for known number of contenders & know packet size Computed by minimizing expected time wastage (by both collisions and empty slots) Tricky to implement because number of contenders is difficult to estimate and can be VERY dynamic

802.11 Adaptive Contention Window 802.11 adaptively sets cw Starts with cw = 31 If no CTS or ACK then increase to 2*cw+1 (63, 127, 255) Reset to 31 on successful transmission 802.11 adaptive scheme is unfair Under contention, unlucky nodes will use larger cw than lucky nodes (due to straight reset after a success) Lucky nodes may be able to transmit several packets while unlucky nodes are counting down for access Fair schemes should use same cw for all contending nodes (better for high congestion too)

Summary A Perfect MAC Protocol Collision avoidance to reduce wasted transmissions Cope with hidden terminal problems Allow exposed terminals to talk Reasonable fairness No MAC protocol does all this!

Tree Protocol for Collision Resolution (divide-and-conquer approach) There are 8 users in a radio cell. At a given epoch, users 0, 1, 2, 5, and 7 have packets ready for transmission, while users 3, 4, and 6 are idle. When the ready users transmit simultaneously, collisions will occur. The interval of time within which the collisions are resolved is referred to as the collision resolution interval (CRI).

Tree Protocol for Collision Resolution Collision resolution can be performed on a per collision resolution interval basis. The channel states are described by the 3-tuple {idle, collision, success}. Assume that the users can detect the channel states. With 8 users, the binary tree has 4 levels, with the root at level 0 and the leaves at level 3, where ready users are indicated by the underline. Level 0 Level 1 Level 2 Level 3

Tree Protocol for Collision Resolution Consider that, at the end of the (i-1)th collision resolution interval, and hence the start of the ith collision resolution interval, users 0, 1, 2, 5 and 7 are ready for packet transmission. At the root node A, collisions occur. Split the tree into two halves and resolve the left half first. Then at intermediate node B (level 1), users 0, 1, and 2 transmit, resulting in collision. Divide the subtree into two halves and search the left half. Users 0 and 1 transmit and collision occurs. Further divide the subtree with node D as the root, into two halves. Since each of the halves only has the leaf node, transmission by user 0, and then by user 1, will both be successful. This completes the search of the left half of the subtree with node D as the root. The algorithm next searches the right half of the subtree with node B as the root. The procedure is repeated with the entire tree has been searched and all ready users have successfully transmitted. A B C D E F G 0 1 2 3 4 5 6 7

Tree Protocol for Collision Resolution

Scheduling approaches to MAC About random access: Simple and easy to implement In low-traffic, packet transfer has low-delay However, limited throughput and in heavier traffic, packet delay has no bound. A station of bad luck may never have a chance to transfer its packet. Scheduling approach: provides orderly access to shared medium so that every station has chance to transfer

Scheduling approach reservation protocol The time line has two kinds of periods: Reservation interval of fixed time length Data transmission period of variable frames. Suppose there are M stations, then the reservation interval has M minislots, and each station has one minislot. Whenever a station wants to transfer a frame, it waits for reservation interval and broadcasts reservation bit in its minislot.

Scheduling approach reservation protocol (Cont.) By listening to the reservation interval, every station knows which stations will transfer frames, and in which order. The stations having reserved for their frame transfer their frames in that order After data transmission period, next reservation interval begins.

Reservation protocol Reservation interval 0 1 2 3 4 5 6 7 Frames-transmission 1 1 1 1 3 5 0 1 2 3 4 5 6 7 1 1 3 7

Scheduling approach polling protocol Stations take turns accessing the medium: At any time, only one station has access right to transfer into medium After this station has done its transmission, the access right is handed over (by some mechanism) to the next station. If the next station has frame to transfer, it transfers the frame, otherwise, the access right is handed over to the next next station. After all stations are polled, next round polling from the station 1 begins.

Centralized polling vs. distributed polling Centralized polling: a center host which polls the stations one by one Distributed polling: station 1 will have the access right first, then station 1 passes the access right to the next station, which will passes the access right to the next next station,

Station interfaces: are connected to form a ring by point-to-point lines Stations: are attached to the ring by station interfaces. token Note: point-to-point lines, not a shared bus. Token: a small frame, runs around the ring, whichever gets the token, it has the right to transmit data frames. The information flows in one direction. Station interfaces have important functions. Token-passing rings a distributed polling network

Comparison of scheduling & random access Scheduling Methodical orderly access: dynamic form of time division multiplexing, round-robin (only) when the stations have information to send. Less variability in delay, supporting applications with stringent delay requirement. In high load, performance is good. E.g., token-ring may reach nearly 100 percent of performance when all stations have plenty of information to send. Some channel bandwidth carries explicit scheduling information.

Comparison of scheduling & random access (Cont.) Random access Chaotic, unordered access If rich bandwidth and light load, random access has low delay, otherwise, delay is undeterminably large. Quite a lot bandwidth is used in collision to alert stations of the presence of other transmissions.

Summary of Chapter 4 We have studied the principles behind data link layer services: error detection and correction ( by the receiver) reliable data transfer link access by sharing a broadcast channel: MAC