Lect 9

Download as pptx, pdf, or txt
Download as pptx, pdf, or txt
You are on page 1of 41

Carrier Sense Multiple Access (CSMA)

Lecture-09

Computer Communication Networking


Introduction
• Multiple access control channels
– Each node is attached to a transmitter/receiver which
communicates via a channel shared by other nodes
– Transmission from any node is received by other nodes

Node 3

Node 4
Node 2 Shared Multiple
Access Control
Channel to BS

Node 1 …
Node N
Introduction
• Multiple access issues
– If more than one node transmit at a time on the control channel
to BS, a collision occurs
– How to determine which node can transmit to BS?

• Multiple access protocols


– Solving multiple access issues
– Different types:
• Contention protocols resolve a collision after it occurs. These
protocols execute a collision resolution protocol after each
collision
• Collision-free protocols ensure that a collision can never
occur.
Channel Sharing Techniques

Static
Channelization

Channel Sharing
Techniques
Scheduling

Dynamic Medium
Access Control
Random Access
Classification of Multiple Access Protocols
Goals of MACs
Round Robin Working

1. Pooling

2. Token Passing
Random Access Protocols

• ALOHA
– Developed in the 1970s for a packet radio network by Hawaii
University.
– Whenever a station has a data, it transmits. Sender finds out
whether transmission was successful or experienced a
collision by listening to the broadcast from the destination
station. Sender retransmits after some random time if there is
a collision.
• Slotted ALOHA
– Improvement: Time is slotted and a packet can only be
transmitted at the beginning of one slot. Thus, it can reduce
the collision duration.
Random Access Protocols (Cont’d)
• CSMA (Carrier Sense Multiple Access)
– Improvement: Start transmission only if no transmission is
ongoing
• CSMA/CD (CSMA with Collision Detection)
– Improvement: Stop ongoing transmission if a collision is
detected
• CSMA/CA (CSMA with Collision Avoidance)
– Improvement: Wait a random time and try again when carrier
is quiet. If still quiet, then transmit
• CSMA/CA with ACK
• CSMA/CA with RTS/CTS
ALOHA

Node 1 Packet Waiting a random time

Node 2 Packet
Retransmission Retransmission

1 2 3 3 2
Time
Collision

Node 3 Packet

Collision mechanism in ALOHA


Throughput of ALOHA
• The probability that n packets arrive in two packets time is given by
n
(2G) e−2G
P(n ) =
n!
where G is traffic load.
• The probability P(0) that a packet is successfully received without
collision is calculated by letting n=0 in the above equation. We get

• We can calculate throughput S with a traffic load G as follows:

• The Maximum throughput of ALOHA is


Slotted ALOHA

Node 1 Packet

Nodes 2 & 3 Packets


Retransmission Retransmission

1 2&3 2 3
Time

Slot Collision

Collision mechanism in slotted ALOHA


Throughput of Slotted ALOHA
• The probability of no collision is given by

• The throughput S is

• The Maximum throughput of slotted ALOHA is


Throughput

0.368

Slotted Aloha
S

0.184

Aloha

G
CSMA (Carrier Sense Multiple Access)

• Max throughput achievable by slotted ALOHA is 0.368.

• CSMA gives improved throughput compared to Aloha


protocols.

• Listens to the channel before transmitting a packet (avoid


avoidable collisions).
Collision Mechanism in CSMA

Node 1 Packet
Node 5 sense
Node 2 Packet
Node 3 Packet Delay

1 2 3 4 5
Time
Delay Collision

Node 4 sense
Kinds of CSMA

Nonpersistent CSMA

CSMA

Persistent CSMA

1-persistent CSMA

p-persistent CSMA
Non Persistent/Persistent CSMA Protocols

• 1-Persistent CSMA Protocol:


Step 1: If the medium is idle, transmit immediately
Step 2: If the medium is busy, continue to listen until medium
becomes idle, and then transmit immediately
– There will always be a collision if two nodes want to retransmit
(usually you stop transmission attempts after few tries)

• Non Persistent CSMA Protocol:


Step 1: If the medium is idle, transmit immediately
Step 2: If the medium is busy, wait a random amount of time and
repeat Step 1
– Random backoff reduces probability of collisions
– Waste idle time if the backoff time is too long
Nonpersistent/x-persistent CSMA Protocols
• p-Persistent CSMA Protocol:

Step 1: If the medium is idle, transmit with probability p, and delay for worst case
propagation delay for one packet with probability

Step 2: If the medium is busy, continue to listen until medium


becomes idle, then go to Step 1

Step 3: If transmission is delayed by one time slot, continue with Step 1

– A good tradeoff between non persistent and 1-persistent CSMA


How to Select Probability p ?

• Assume that N nodes have a packet to send and the


medium is busy
• Then, Np is the expected number of nodes that will attempt
to transmit once the medium becomes idle
• If Np > 1, then a collision is expected to occur

Therefore, network must make sure that Np < 1 to avoid


collision, where N is the maximum number of nodes that can
be active at a time
Throughput

1.0 0.01-persistent CSMA


0.9 Nonpersistent CSMA
0.8
0.7
0.1-persistent CSMA
0.6
0.5-persistent CSMA
0.5
S

0.4 1-persistent CSMA


0.3
0.2 Slotted Aloha
0.1 Aloha
0

0 1 2 3 4 5 6 7 8 9
G
CSMA/CD (CSMA with Collision Detection)
• In CSMA, if 2 terminals begin sending packet
at the same time, each will transmit its
complete packet (although collision is taking
place).
• Wasting medium for an entire packet time.
• CSMA/CD
Step 1:If the medium is idle, transmit
Step 2:If the medium is busy, continue to
listen until the channel is idle then
transmit
Step 3:If a collision is detected during
transmission, cease transmitting
Step 4:Wait a random amount of time and
repeat the same algorithm
CSMA/CD (Cont’d)
T0 A begins transmission
A B

T0+α-ε B begins transmission


A B

T0 + α B detects collision
A B

T0+2α -ε A detects collision just


before end of transmission
A B
Time
(α is the propagation time)
CSMA/CA (CSMA with collision Avoidance)
• All terminals listen to the same medium as CSMA/CD.
• Terminal ready to transmit senses the medium.
• If medium is busy it waits until the end of current transmission.
• It again waits for an additional predetermined time period DIFS
(Distributed inter frame Space).
• Then picks up a random number of slots (the initial value of backoff
counter) within a contention window to wait before transmitting its
frame.
• If there are transmissions by other terminals during this time period
(backoff time), the terminal freezes its counter.
• It resumes count down after other terminals finish transmission +
DIFS. The terminal can start its transmission when the counter
reaches to zero.
CSMA/CA (Cont’d)

Node A’s frame Node B’s frame Node C’s frame

Delay: B
Delay: C Time
Nodes B & C sense
the medium
Nodes C starts
Nodes B resenses the medium transmitting.
and transmits its frame.
Node C freezes its counter.

Nodes C resenses the


medium and starts
decrementing its counter.
CSMA/CA Explained

Contention DIFS Contention window


DIFS window

Medium Busy Next Frame


Time
Defer access Slot

Backoff after defer

DIFS – Distributed Inter Frame Spacing


CSMA/CA with ACK

• Immediate Acknowledgements from receiver upon reception of


data frame without any need for sensing the medium.

• ACK frame transmitted after time interval SIFS (Short Inter-


Frame Space) (SIFS < DIFS)

• Receiver transmits ACK without sensing the medium.

• If ACK is lost, retransmission done.


CSMA/CA/ACK

DIFS Time
Data
Source
SIFS
ACK
Destination
DIFS Contention window

Next Frame
Other
Defer access Backoff after defer

SIFS – Short Inter Frame Spacing


CSMA/CA with RTS/CTS

• Transmitter sends an RTS (request to send) after medium has


been idle for time interval more than DIFS.

• Receiver responds with CTS (clear to send) after medium has


been idle for SIFS.

• Then Data is exchanged.

• RTS/CTS is used for reserving channel for data transmission so


that the collision can only occur in control message.
RTS/CTS

Node A Node B

Propagation delay
RTS

CTS

Data

ACK
Non Persistent CSMA
• What if busy? What if idle?
• Nonpersistent CSMA rules:
1. If channel idle, transmit;
2. If channel busy, wait random (probability distribution)
amount of time (retransmission delay) & retry
• Behavior & flow diagram

• Random delay reduces probability of collision


• Channel possible idle when wait but busy again before station senses to retry –
capacity wasted, efficiency reduced
1-Persistent CSMA
• Avoid idle channel time, send with probability of 1
• 1-persistent CSMA rules:
1. If channel idle, transmit;
2. If channel busy, listen until idle; then transmit immediately
• Behavior & flow diagram

• Selfish than nonpersistent CSMA


• Highest chance of collision, if two or more stations waiting, a collision is unavoidable
p-Persistent CSMA
• Reduce collisions and idle time, improve efficiency
• Channel has time slots, duration > max propagation delay
• p-persistent CSMA rules:
1. If channel idle, transmit with probability p
2. With probability (1–p), wait for begin of next time slot, listen again
a. If channel idle, repeat step 1
b. If channel busy, act as collision, use back-off procedure, wait, listen again
• Behavior & flow diagram
CSMA with Collision Detection
(CSMA/CD)
• With CSMA in collision, channel remains unusable
for duration of transmission
– For long damaged frames, capacity largely wasted
• Better if stations listen whilst transmitting
• CSMA/CD rules:
1. If channel idle, use one of persistent methods to
transmit
2. Listen to channel when transmitting
3. If collision detected, jam and then cease transmission
4. After jam, back-off (wait random time) then retry
• Energy on channel
• Zero, normal,
CSMA with Collision Avoidance (CSMA/CA)
• Collision detection easy for wired LAN, difficult for wireless
• Receiver shut off while transmitting, need avoid collisions

• CSMA/CA rules:
1. Continue sense channel until idle, not send immediately, wait for
interframe space (IFS) time to defer transmission
2. After IFS, if channel busy, repeat step 1; if channel still idle, use counter of
contention window (CW, binary exponential num of time slots) to wait
3. After each time slot in CW, sense channel, if busy, stop CW counter until
channel idle again, then resume counter
4. After CW counter expires, transmit frame and wait for ACK
5. If no ACK, double CW size (binary exponential back-off), repeat step 1
Flow Diagram of CSMA/CA
• Even if channel sensed idle, distant
station may start sending
• IFS allows sent signal to reach
• IFS can also use to set priority
– Station with shorter IFS, higher priority

• Channel need to be sensed before and


after IFS, also in contention time

• CW has min and max size, size will


remain after getting CWmax

• In case of no ACK, retry to send


• After max retries, has to give up
Revision
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!


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


Collision Avoidance: RTS-CTS Exchange
• Explicit channel reservation
– Sender: send short RTS:
request to send
– Receiver: reply with short CTS:
clear to send
– CTS reserves channel for
sender, notifying (possibly
hidden) stations

• RTS and CTS short:


– collisions less likely, of shorter
duration
– end result similar to collision
detection

• Avoid hidden station collisions

• Not widely used/implemented


– Consider typical traffic patterns
Further Reading

• 364 Page onward Behrouz CH 12


• 485 Page onward W. Stalling CH 16
• 190 Page onward Taunanbaum CH 04

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy