Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

21
Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008

Transcript of Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Page 1: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Medium Access Control

Nick FeamsterCS 4251 Computer Networking II

Spring 2008

Page 2: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Some Multiple Access Protocols

• CSMA/CD

• Token passing

• Wireless LAN Protocols

Page 3: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Random Access MAC Protocols

• Non-Carrier-Sense protocols: doesn’t “listen” to the channel before transmitting– ALOHA

• Carrier-Sense protocols: senses the channel before transmitting– CSMA (Carrier Sense Multiple Access): does not

detect collision.– CSMA/CD (Ethernet): A node “listens” before/while

transmitting to determine whether a collision happens.

Page 4: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

ALOHA

• Radio-based communication network– Developed in 1970s at the Univ of Hawaii

• Basic idea: transmit when a node has data to be sent.– Receiver sends ACK for data– Detect collisions by timing out for ACK– Recover from collision by trying after random delay

• Too short: large number of collisions• Too long: underutilization

Page 5: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Ethernet MAC

• If line is idle (no carrier sensed) send packet immediately

• If line is busy (carrier sensed) wait until idle and transmit packet immediately

• If collision detected– Stop sending and jam signal– Jam signal: make sure all other transmitters are

aware of collision– Wait a random time (Exponential backoff), and try

again

Page 6: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Questions

• How does sender detect collision?• How long does it take?

Page 7: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Ethernet Performance

• Ethernets work best under light loads– Utilization over 30% is considered heavy

• Peak throughput worse with– More hosts

• More collisions needed to identify single sender– Smaller packet sizes

• More frequent arbitration– Longer links

• Collisions take longer to observe, more wasted bandwidth

Page 8: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Ethernet MAC Protocol

Collision detection can take as long as 2 .

Page 9: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Carrier Sense Multiple Access (CSMA)

• Listen to medium and wait until it is free(no one else is talking)

• Wait a random backoff time

• Advantage: Simple to implement

• Disadvantage: Cannot recover from a collision

Page 10: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Wireless Interference

• Two transmitting stations interfere with each other at the receiver

• Receiver gets garbage

A B

C

Page 11: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Carrier Sense Multiple Accesswith Collision Detection (CSMA-CD)

• Procedure– Listen to medium and wait until it is free– Start talking, but listen to see if someone else starts talking too– If collision, stop; start talking after a random backoff time

• Used for hub-based Ethernet

• Advantage: More efficient than basic CSMA

• Disadvantage: Requires ability to detect collisions– More difficult in wireless scenario

Page 12: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Collision Detection in Wireless

• No “fate sharing” of the link– High loss rates– Variable channel conditions

• Radios are not full duplex– Cannot simultaneously transmit and receive– Transmit signal is stronger than received signal

Page 13: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Solution: Link-Layer Acknowledgments

• Absence of ACK from receiver signals packet loss to sender

• Sender interprets packet loss as being caused by collision

Problem: Does not handle hidden terminal cases.

Page 14: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Carrier Sense Multiple Accesswith Collision Avoidance (CSMA-CA)

• Similar to CSMA but control frames are exchanged instead of data packets– RTS: request to send– CTS: clear to send– DATA: actual packet– ACK: acknowledgement

Page 15: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Carrier Sense Multiple Accesswith Collision Avoidance (CSMA-CA)

• Small control frames lessen the cost of collisions (when data is large)

• RTS + CTS provide “virtual carrier sense” • protects against hidden terminal

A B

Page 16: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Random Contention Access

• Slotted contention period– Used by all carrier sense variants– Provides random access to the channel

• Operation– Each node selects a random backoff 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

Page 17: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Virtual Carrier Sense

• Provided by RTS & CTS• Prevents hidden terminal collisions • Typically unnecessary

A B C

RTS CTS

Page 18: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Physical Carrier Sense Range

• Carrier can be sensed at lower levels than packets can be received– Results in larger carrier sense

range than transmission range– More than double the range in

NS2 802.11 simulations

• Long carrier sense range helps protect from interference

Receive Range

Carrier Sense Range

Page 19: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Hidden Terminal Revisited

• Virtual carrier sense no longer needed in this situation

A B C

RTS CTS

Physical Carrier Sense

Page 20: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.
Page 21: Medium Access Control Nick Feamster CS 4251 Computer Networking II Spring 2008.

Physical Carrier Sense

• Energy detection threshold– Monitors channel during “idle” times between packets to

measure the noise floor– Energy levels above the this noise floor by a threshold trigger

carrier sense

• DSSS correlation threshold– Monitors the channel for Direct Sequence Spread Spectrum

(DSSS) coded signal– Triggers carrier sense if the correlation peak is above a

threshold– More sensitive than energy detection (but only works for 802.11

transmissions)

• High BER disrupts transmission but not detection