Sie sind auf Seite 1von 30

Wireless Networks

Lecture 05
CSMA (Carrier Sense Multiple Access)

• CSMA: listen before talk (transmit (LBT)


• If channel sensed idle: transmit entire frame
• If channel sensed busy, defer transmission
• Human analogy: don’t interrupt others!
Carrier Sense Multiple Access
• We could achieve better throughput if we
could listen to the channel before transmitting
a packet
• This way, we would stop avoidable collisions.
• To do this, we need “Carrier Sense Multiple
Access,” or CSMA, protocols
Assumptions with CSMA Networks
1. Constant length packets
2. No errors, except those caused by collisions
3. Each host can sense the transmissions of all
other hosts
4. The propagation delay is small compared to
the transmission time
CSMA
There are several types of CSMA
protocols:
• 1-Persistent CSMA
• Non-Persistent CSMA
• P-Persistent CSMA
Non-Persistent CSMA
Sense the channel.
–If busy, wait a random amount of time and
sense the channel again
–If idle, transmit a packet immediately
• If collision occurs
–wait a random amount of time and start all
over again
1-Persistent CSMA
• Sense the channel.
–If busy, keep listening to the channel and
transmit immediately when the channel
becomes idle.
–If idle, transmit a packet immediately.
• If collision occurs,
–Wait a random amount of time and start over
again.
1-Persistent CSMA
The protocol is called 1-persistent because the
host transmits with a probability of whenever
it finds the channel idle.
1-Persistent CSMA with
Satellite Systems
Satellite system: long prop. delay (270 msec)
Carrier sense makes no sense
It takes 270 msecs to sense the channel, which is
a really long time
Vulnerability time = 540 msec
(1/2 a second is forever in a network!)
1-Persistent CSMA
Even if prop. delay is zero, there will be
collisions
• Example:
–If stations B and C become ready in the middle of
A’s transmission, B and C will wait until the end of
A’s transmission and then both will begin
transmitted
simultaneously, resulting in a collision.
• If B and C were not so greedy, there would be
fewer collisions
Tradeoff between 1- and Non-
Persistent CSMA
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
P-Persistent CSMA
combines 1-persistent goal of reduced idle
channel time with the non-persistent goal of
reduced collisions.
– sense constantly if busy and the station
needs to send a packet
– when the channel becomes idle, transmit
packet with probability p
– with probability 1-p station waits an
additional tprop before sensing again
P-Persistent CSMA
1. 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.
2. Detect collisions
– If a collision occurs, wait a random amount of
time and go to step 1
CSMA

increases the chance for


•• Reduces chance of Collisions collisions
•Reduces the efficiency • 1-persistant
• p-persistant
CSMA/CD
Ethernet (also 802.3) standardizes the 1-persistent
CSMA/CD multi-access control protocol.
1. Each station listens before it transmits.
2. If the channel is busy, it waits until the channel goes
idle, and then it transmits.
3. If the channel is idle it transmits immediately. Continue
sensing.
4. If collision is detected, transmit a brief jamming signal,
then cease transmission, wait for a random time, and
retransmit.
• collision detection is not by waiting for an ACK

17
Collisions in Ethernet
• The collision resolution process of Ethernet
requires that a collision is detected while a station
is still transmitting.

t0
A A Begins Transmission B

t0+a-e
A B Begins Transmission B
18
Collisions in Ethernet

t0+a
A B Detects Collision B

t0 +2a
A A Detects Collision B
Just Before End
of Transmission

• Restrictions: Each frame should be at least twice as long


as the time to detect a collision (2 · maximum propagation
19 delay).
Exponential Backoff Algorithm
• If a station is involved in a collision, it waits a random
amount of time before attempting a retransmission.
• The random time is determined by the following
algorithm:
• Set “slot time” to 2a.
• After first collision wait 0 or 1 time unit.
• After i-th collision, wait a random number
between 0 and 2 i-1 time slots.
• Do not increase random number range if i=10.
• Give up after 16 collisions.

20
Wireless 802.11 LAN
• Uses CSMA/CA
• Why CA and CD?
– Difficult to detect collisions in a radio environment
– why?
– Hidden station problem:
• Two mutually far away stations A and C
want to send to B.
• At A and C, channel appears idle
• But collision occurs at B
21
Why is it difficult to detect collisions in a radio
environment?

• A transmitting station cannot


effectively distinguish incoming weak
signals from noise and the effects of
its own transmission; need a full
duplex radio to listen and transmit
on same frequency

23
Mechanisms for CA
• Use of Request-To-Send (RTS) and Confirm-to-Send (CTS)
mechanism
– When a station wants to send a packet, it first sends an
RTS. The receiving station responds with a CTS. Stations
that can hear the RTS or the CTS then mark that the
medium will be busy for the duration of the request
(indicated by Duration ID in the RTS and CTS)
– Stations will adjust their Network Allocation Vector (NAV):
time that must elapse before a station can sample channel
for idle status
• this is called virtual carrier sensing
– RTS/CTS are smaller than long packets that can collide
• Use of InterFrame Spaces (IFS)
27
802.11 MAC

• IEEE 802.11 combines a demand-assignment MAC


protocol with random access
– PCF (Point Coordination Mode) – Polling
• CFP (Contention-Free Period) in which access point polls hosts
– DCF (Distributed Coordination Mode)
• CP (Contention Period) in which CSMA/CA is used
stretching
CP
CFP Frame CFP
Super-frame Foreshortened CFP

28
DCF mode transmission
without RTS/CTS
DIFS
Data
source
SIFS
Ack
destination
CW
NAV DIFS
other
Defer access Random backoff time

Exercise: Show timing diagram for DCF mode with RTS/CTS

29

Das könnte Ihnen auch gefallen