Medium Access Control

45
Medium Access Control Medium Access Control Zhibin Wu

description

Medium Access Control. Zhibin Wu. Lecture Overview. Introduction Random Access Aloha Slotted Aloha CSMA CSMA/CD CSMA/CA Scheduled Access TDMA Dynamic TDMA Spread-Spectrum/CDMA. Medium Access Sublayer. network. Medium access (MAC) sublayer is not relevant on point-to-point links - PowerPoint PPT Presentation

Transcript of Medium Access Control

Page 1: Medium Access Control

Medium Access ControlMedium Access Control

Zhibin Wu

Page 2: Medium Access Control

Lecture OverviewLecture Overview

Introduction Random Access

– Aloha– Slotted Aloha– CSMA– CSMA/CD– CSMA/CA

Scheduled Access– TDMA– Dynamic TDMA

Spread-Spectrum/CDMA

Page 3: Medium Access Control

Medium Access SublayerMedium Access Sublayer

Medium access (MAC) sublayer is not relevant on point-to-point links

The MAC sublayer is only used in broadcast or shared channel networks

All communication entities “share” a common channel

Examples:

– Wired networks: Ethernet LAN

– Wireless & Mobile Networks: Satellite, Cellular, Wireless LAN,

– Packet radio network?

physical

network

Data linkMACLLC Link layer control

Medium access control

Page 4: Medium Access Control

Share a Channel IdeallyShare a Channel Ideally

Broadcast channel of rate R bps

1. When one node wants to transmit, it can send at rate R.

2. When M nodes want to transmit, each can send at average rate R/M

Page 5: Medium Access Control

Random Access ProtocolsRandom Access Protocols

Single channel shared by a large number of hosts

No coordination between hosts

Control is completely distributed

Examples: ALOHA, CSMA, CSMA/CD

Page 6: Medium Access Control

Scenarios of ALOHAScenarios of ALOHA

A group of nodes trying to sending frames to a central node

Star-topology. Not a complete solution

for bi-directional communication– For half-duplex

device, what if a data packet arrives while it is receiving?

Page 7: Medium Access Control

Pure AlohaPure Aloha

In Pure Aloha, frames are transmitted at completely arbitrary times.

Page 8: Medium Access Control

Aloha AlgorithmAloha Algorithm

1. Transmit whenever you have data to send

2. Listen to the broadcast (probably a separate channel)– Because broadcast is fed back, the sending host can

always find out if its packet was destroyed just by listening to the downward broadcast one round-trip time after sending the packet

3. If the packet was destroyed, wait a random amount of time and send it again– The waiting time must be random to prevent the same

packets from colliding over and over again

Page 9: Medium Access Control

Vulnerable PeriodVulnerable Period

Vulnerable period for the shaded frame is 2t Note that if the first bit of a new packet overlaps with the last bit

of a packet almost finished, both packets are totally destroyed. (No capture effect)

Page 10: Medium Access Control

Analysis of Aloha Analysis of Aloha

Packet Arrival is Poisson Process P [k arrivals in t seconds] =

Let G be the total number of frames attempted in t seconds– P [k attempts in t seconds] =

Conditional successful probability for one attempt is :– P0 = P [0 other attempts in 2t seconds] =e-2Gt

Set t as unit frame time Let S be the mean number of successful attempts S=GP0=Ge-2G

S is optimum at G=1/2 S=1/2e = 0.184

!

)(

k

te kt

!

)(

k

Gte kGt

Page 11: Medium Access Control

Slotted AlohaSlotted Aloha

Transmission of frames are synchronized slot by slot.

Channel feedback about whether packet is received or not

Page 12: Medium Access Control

Slotted Aloha (Continued)Slotted Aloha (Continued)

Slotted ALOHA cuts the vulnerable period for packets from 2t to t.

Time is slotted. Packets must be transmitted within a slot.

Procedure1. If a host has a packet to transmit, it waits until the

beginning of the next slot before sending

2. Listen to the broadcast and check if the packet was destroyed

3. If there was a collision, wait a random number of slots and try to send again

Page 13: Medium Access Control

Analysis of Slotted ALOHAAnalysis of Slotted ALOHA

Packet Arrival is Poisson Process

P [k arrivals in t seconds] =

Let G be the total number of frames attempted in t seconds– P [k attempts in t seconds] =

Successful probability for each slot is :

P [1 attempts in a t seconds slot] =Ge-Gt

Set Slot time t as unit time, then S=Ge-G

S is optimum at G=1

S=1/e = 0.368

!

)(

k

te kt

!

)(

k

Gte kGt

Page 14: Medium Access Control

Performance of ALOHAPerformance of ALOHA

Throughput versus offered traffic for ALOHA systems The main reason for poor channel utilization of ALOHA (pure or slotted) is

that all stations can transmit at will, without paying attention to what the other stations are doing.

Page 15: Medium Access Control

CSMACSMA

Protocols in which stations listen for a carrier (i.e., a transmission) and act accordingly are called carrier sense protocols.

There are several types of CSMA protocols:– Non-Persistent CSMA

– 1-Persistent CSMA

– P-Persistent CSMA

Page 16: Medium Access Control

Assumptions with CSMA NetworksAssumptions with CSMA Networks

Constant length packets

No errors, except those caused by collisions

No capture effect

Each host can sense the transmissions of all other hosts

The propagation delay is small compared to the transmission time

Page 17: Medium Access Control

Propagation DelayPropagation Delay

D only sense A’s transmission after a propagation delay τ

If τ is larger than packet transmission time, there are too much time wastage.

CSMA in satellite communication? No.

BA C D

The size (length) of the network must be limited!

Page 18: Medium Access Control

Non-persistent CSMANon-persistent CSMA

To send data, a station first listens to the channel to see if anyone else is transmitting.

If so, the station waits a random period of time (instead of keeping sensing until the end of the transmission) and repeats the algorithm. Otherwise, it transmits a frame.

If a collision occurs, the station waits a random amount of time and starts all over again.

Assumption:

propagation delay is a constant common to all nodes:– a is the ratio of propagation delay to packet transmission time

Page 19: Medium Access Control

Analysis of Non-persistent CSMAAnalysis of Non-persistent CSMA

S= U/(B+I)

B = Y + 1 + a , I = 1/G

U = e-aG

FY(y)=P{no packet occur in an duration of a-y } = e-G(a-y)

Busy period

a

1YBusy periodIdle period

1a

Normalized Time

Unsuccessful transmission period

Successful transmission period

a

)1(1

)( aGeG

aYE

aG

aG

eaG

GeS

)21(

Page 20: Medium Access Control

Discussion of CollisionsDiscussion of Collisions

What's the effect of signal propagation delay a? – The longer the delay, the more the collisions, and the worse the

performance of the protocol.

How about zero propagation delay ? – There still exist chances of collisions. S = G/(1+G)

Is this protocol any better than ALOHA (both pure and slotted) ? – Yes, because both stations have the decency to desist from

interfering with the third station's frame.

Page 21: Medium Access Control

1-persistent CSMA1-persistent CSMA

1-persistent CSMA (Carrier Sense Multiple Access): 1. To send data, a station first listens to the channel to see if anyone else is

transmitting. 2. If so, the station waits (keeps sensing it) until the channel becomes idle.

Otherwise, it transmits a frame. 3. If a collision occurs, the station waits a random amount of time and

starts all over again.

It is called 1-persistent because the station transmits with a probability of 1 whenever it starts sensing the channel and finds the channel idle. (Greedy)

This protocol has worse channel utilization than non-persistent CSMA.

Page 22: Medium Access Control

Tradeoff between Non-persistent and 1-persistentTradeoff between Non-persistent and 1-persistent

If B and C become ready in the middle of A’s transmission,– 1-Persistent: B and C collide

– Non-Persistent: B and C probably do not collide

If only B becomes ready in the middle of A’s transmission,– 1-Persistent: B succeeds as soon as A ends

– Non-Persistent: B may have to wait

Page 23: Medium Access Control

P-persistent CSMAP-persistent CSMA

Assume channels are slotted

One slot = contention period (i.e., one round trip propagation delay)

Algorithm Sense the channel

– If channel is idle, transmit a packet with probability p if a packet was transmitted, go to step 2 if a packet was not transmitted, wait one slot and go to step

1– If channel is busy, wait one slot and go to step 1.

– In other words, wait until idle and then transmit with probability p

Detect collisions– If a collision occurs, wait a random amount of time and go to step 1

Page 24: Medium Access Control

Persistent and Non-persistent CSMAPersistent and Non-persistent CSMA

Comparison of the channel utilization versus load for various random access protocols.

Page 25: Medium Access Control

CSMA with Collision DetectionCSMA with Collision Detection

CSMA/CD (Carrier Sense Multiple Access with Collision Detection) protocol further improves ALOHA by aborting transmissions as soon as a collision is detected.

The conceptual model: • To send data, a station first listens to the channel to see if anyone else

is transmitting.

• If so, the station waits until the end of the transmission (1-persistent) or wait a random period of time and repeats the algorithm (non-persistent). Otherwise, it transmits a frame.

• If a collision occurs, the station will detect the collision, abort its transmission, waits a random amount of time, and starts all over again.

Page 26: Medium Access Control

How to Detect CollisionHow to Detect Collision

Prerequisite: A node can listening while talking

Ethernet cables

Tx Rx

Page 27: Medium Access Control

CSMA/CD ContinuedCSMA/CD Continued

• CSMA/CD can be in one of three states: contention, transmission, or idle

• The minimum time to detect the collision is the time it takes the signal to propagate from one station to the other.

• How long could the transmitting station be sure it has seized the network ? ( or 2 ? where is time equal to the full propagation)

• Model the contention interval as slotted aloha with slot width 2

Page 28: Medium Access Control

CSMA/CACSMA/CA

Wireless LAN

How can detect collision if you cannot listening while talking?

Collision Avoidance– Random Backoff (instead of 1-persistent)

– RTS/CTS

CS no longer works well– Rules:

carrier ==> do not transmit no carrier ==> OK to transmit

– But the above rules do not always apply to wireless.

Page 29: Medium Access Control

Problems with carrier sensingProblems with carrier sensing

Y

Z

W

Hidden terminal problem

W finds that medium is freeand it transmits a packet to Z

no carrier ===> OK to transmit/

Page 30: Medium Access Control

Problems with carrier sensingProblems with carrier sensing

Z

W

YX

Exposed terminal problem

Z is transmittingto W

Y will not transmit to Xeven though it cannot interfere

Presence of carrier ===> hold off transmission/

Page 31: Medium Access Control

Solving Hidden Node problem with RTS/CTSSolving Hidden Node problem with RTS/CTS

Y

ZX

W

RTS CTS

listen RTS ==> transmitter is close to melisten CTS ==> receiver is close to me

- listen RTS- wait long enough for the requested station to respond with CTS- if (timeout) then ready to transmit

- listen CTS- wait long enough for the transmitter to send its data

Note: RTS/CTS does not solve exposed terminal problem. In the example above, X can send RTS, but CTS from the responder will collide with Y’s data.

Page 32: Medium Access Control

RTS/CTS exchange exampleRTS/CTS exchange example

RTS + CTS + Frame + ACK exchange invoked when frame size is large NAV (Network Allocation Vector)

– NAV maintains prediction of future traffic on the medium based on duration information that is announced in RTS/CTS frames prior to actual exchange of data

Src

DIFS

ACK

RTS

Dest

Frame

CTS

352 µs 10

µs

SIFS

8192 s

Dest NAV (RTS)

NAV (CTS)

304µs 10

µs

10µs

304µs

Page 33: Medium Access Control

Pros & Cons of Random AccessPros & Cons of Random Access

Advantages– Short delay for bursty traffic

– Simple (due to distributed control)

– Flexible to fluctuations in the number of hosts

– Fairness

Disadvantages– Low channel efficiency with a large number of hosts

– Not good for continuous traffic (e.g., voice)

– Cannot support priority traffic

– High variance in transmission delays

Page 34: Medium Access Control

Scheduled AccessScheduled Access

TDMA

Dynamic TDMA

Widely used– cellular,

– Wi-Fi (HyperLAN),

– IEEE 802.16

– Wireless ATM

Page 35: Medium Access Control

TDMATDMA

Time Division Multiple Access

Page 36: Medium Access Control

TDMA ContinuedTDMA Continued

access to channel in "rounds"

each station gets fixed length slot (length = packet transmission time) in each round

unused slots go idle

example: 6-station LAN, 1,3,4 have packets, slots 2,5,6 idle

Page 37: Medium Access Control

Dynamic TDMADynamic TDMA

In dynamic time division multiple access, a scheduling algorithm dynamically reserves a variable number of timeslots in each frame to variable user data streams, based on the traffic demand of each user data stream.

Negotiations (beforehand) to determine how to allocate slots dynamically.

Modempreamble

TDM Downlink D-TDMA UplinkS-ALOHA

control

User B User C

TDMA Frame

Burst from User ATo Access Point

Burst from Access Point -> Mobiles

Page 38: Medium Access Control

Summary of Scheduled Access ProtocolsSummary of Scheduled Access Protocols

Avoid of contention/collision; better channel efficiency with a large number of hosts

predetermined channel allocation

Need centralized control

Require global synchronization

Guard time period to protect slots

Delay?

Page 39: Medium Access Control

Spread Spectrum and CDMASpread Spectrum and CDMA

What if not divide up the channel by time (as in TDMA), or frequency (as in FDMA)? Is collision inevitable?

Not if collision is no longer damaging!– Is there any way to decode bits garbled by other overlapping

frames?

CDMA based on Spread Spectrum A new perspective to solve multiple access problems Spread Spectrum is a PHY innovation, not a MAC technique. CDMA encodes data with a special code associated with each

user and uses the constructive interference properties of the special codes to perform the multiplexing.

Page 40: Medium Access Control

Spread SpectrumSpread Spectrum

Idea– spread signal over wider frequency band than required

– originally deigned to thwart jamming

Frequency Hopping– transmit over random sequence of frequencies

– sender and receiver share… pseudorandom number generator seed

Page 41: Medium Access Control

Spread Spectrum (cont)Spread Spectrum (cont)

Direct Sequence– for each bit, send XOR of that bit and n random bits– random sequence known to both sender and receiver – called n-bit chipping code – 802.11 defines an 11-bit chipping code

Random sequence: 0100101101011001

Data stream: 1010

XOR of the two: 1011101110101001

0

0

0

1

1

1

Page 42: Medium Access Control

Code Division Multiple Access (CDMA)Code Division Multiple Access (CDMA)

Multiplexing Technique used with spread spectrum Start with data signal rate D

– Called bit data rate

Break each bit into k chips according to fixed pattern specific to each user– User’s code

New channel has chip data rate kD chips per second E.g. k=6, three users (A,B,C) communicating with base receiver R Code for A = <1,-1,-1,1,-1,1> Code for B = <1,1,-1,-1,1,1> Code for C = <1,1,-1,1,1,-1>

Page 43: Medium Access Control

CDMA ExampleCDMA Example

Page 44: Medium Access Control

CDMA ExplanationCDMA Explanation

Consider A communicating with base Base knows A’s code Assume communication already synchronized A wants to send a 1

– Send chip pattern <1,-1,-1,1,-1,1> A’s code

A wants to send 0– Send chip[ pattern <-1,1,1,-1,1,-1>

Complement of A’s code Decoder ignores other sources when using A’s code to decode

– Orthogonal codes

Page 45: Medium Access Control

Topics Not Covered in This LectureTopics Not Covered in This Lecture

Dynamic behavior of Aloha– Strict mathematical analysis

– Stabilize Aloha systems with channel feedback

Taking Turns MAC protocols– Token Ring

FDMA