0% found this document useful (0 votes)
16 views39 pages

MAC Protocol Lesson 2 Edited 2025 HOME Edition

This document presents an overview of Medium Access Control (MAC) protocols, focusing on contention-based protocols such as ALOHA and CSMA. It discusses the principles of these protocols, including their operational mechanisms, advantages, and drawbacks, particularly in the context of wireless sensor networks. Key concepts like RTS/CTS handshake, exposed and hidden terminal problems, and various CSMA strategies are also explored to illustrate how these protocols manage data transmission and minimize collisions.

Uploaded by

Chris Mwape Jr.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views39 pages

MAC Protocol Lesson 2 Edited 2025 HOME Edition

This document presents an overview of Medium Access Control (MAC) protocols, focusing on contention-based protocols such as ALOHA and CSMA. It discusses the principles of these protocols, including their operational mechanisms, advantages, and drawbacks, particularly in the context of wireless sensor networks. Key concepts like RTS/CTS handshake, exposed and hidden terminal problems, and various CSMA strategies are also explored to illustrate how these protocols manage data transmission and minimize collisions.

Uploaded by

Chris Mwape Jr.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 39

Copperbelt University,

School of Engineering,
Mechanical Department

Topic : Medium access control protocols (L2)


Contention–based MAC protocol

Welcome !

Presented by
Mr Melele P
Goals of this Unit -MAC
 Fundamentals of MAC Protocols for Wireless Sensor
Networks,
 Low Duty Cycle Protocols And Wakeup Concepts
 Contention –based protocol
 Schedule – based protocol
 SMAC
 B-MAC Protocol,
 TRAMAC
 IEEE 802.15.4

2
Today’s Lesson Outline
 Introduction to Contention – based protocols
 Introduction of CSMA protocol
 Nonpersistent
 1-persistent
 CSMA/CA protocol
 RTS/CTS handshake principles
 Illustrations of RTS/CTS protocols
 Exposed and Hidden Terminal Problem
 Comparison of CSMA/CA and TDMA protocols

3
Contention – Based Protocols

4
Contention – Based Protocols/Random access Schemes

 Introduction
 With contention-based protocols the success of any
transmission is not guaranteed because two or more
sources may be transmitting at the same time, which
results in the collision of their packets.
 For this reason, packets may have to be transmitted and
retransmitted a number of times until they are successfully
transmitted.
 Thus, the main concern of the random access schemes is
transmission scheduling to minimize the probability of
packet collision.
 Protocols to be covered:
 ALOHA and CSMA

5
Contention – Based Protocols/Random access Schemes

 ALOHA System – Introduction


 Is a simple random assignment protocol developed to
regulate access to a shared transmission medium among
uncoordinated contending users.
 The protocol was originally developed for ground-based
packet broadcasting networks and was used to connect
remote users to mainframe computers
 The Aloha system was developed by Norman Abramson at
the University of Hawaii in the 1970s.
 The goal was to develop an inexpensive method of data
communication among the different University of Hawaii
campuses scattered across the Pacific Ocean.

6
Contention – Based Protocols/Random access Schemes

 ALOHA System – Introduction


 The original scheme is called the pure Aloha, and its basic
idea is to permit a user to transmit a packet as soon as the
packet is generated, hoping that it does not suffer
interference from other users’ packets.

 If two or more sources transmit and their packets overlap in


time, even partially, interference results and all involved
transmissions are deemed unsuccessful and such packets
will need to be retransmitted.

7
Contention – Based Protocols/Random access Schemes

 ALOHA System – Drawbacks


 Main drawback of the protocol, is that network performance
degrades severely as the number of collisions rises rapidly
with increased load.

 To improve the performance of pure ALOHA, slotted


ALOHA was proposed.
 In this scheme, all communication nodes are synchronized
and all packets have the same length.

 the communication channel is divided into uniform time


slots whose duration is equal to the transmission time of a
data packet.
8
Contention – Based Protocols/Random access Schemes

 ALOHA System – Solution to Drawbacks


 Despite this performance improvement, ALOHA and pure
ALOHA remain inefficient under moderate to heavy
load conditions.
 In networks where the propagation delay is much shorter
than the transmission time of a data packet, nodes can
become aware almost immediately of an ongoing packet
transmission.
 This observation led to the development of a new class of
media access schemes, whereby before a transmission is
attempted, a station that has a packet to transmit first
‘‘listens’’ to the channel to determine if it is busy.
 Carrier sensing forms the basis of the CSMA protocol.

9
CSMA MAC Protocol - Introduction
 As humans, we’ve evolved an elaborate set of protocols for
sharing the broadcast channel:

 Computer networks similarly have protocols—so-called


multiple access protocols—by which nodes regulate
their transmission into the shared broadcast channel
 multiple access protocols are needed in a wide variety of
network settings, including both wired and wireless access
networks, and satellite networks.

10
CSMA MAC Protocol - Introduction
 Various multiple access channels

From Kurose James Et al, Computer networking-A top down Approach

11
CSMA MAC Protocol - Introduction
 As humans, we have human protocols that allow us not only to behave with
more civility, but also to decrease the amount of time spent “colliding” with
each other in conversation and, consequently, to increase the amount of
data we exchange in our conversations.
 Specifically, there are two important rules for polite human conversation:
 Listen before speaking. If someone else is speaking, wait until they are
finished. In the networking world, this is called carrier sensing—a node
listens to the channel before transmitting. If a frame from another node is
currently being transmitted into the channel, a node then waits until it
detects no transmissions for a short amount of time and then begins
transmission.
 If someone else begins talking at the same time, stop talking. In the
networking world, this is called collision detection—a transmitting node
listens to the channel while it is transmitting. If it detects that another node
is transmitting an interfering frame, it stops transmitting and waits a random
amount of time before repeating the sense-and-transmit-when-idle cycle.

12
CSMA MAC Protocol
 Basic principle: Listen ( if the channel is busy) before
transmitting…
 CSMA protocol can be either Persistent or non-persistent
( further divided into 1-persistent or p-persistent)
 This means – node listens persistently until the medium is free
 Then immediately grabs the medium to transmit a packet…
 These are highly time critical applications…if packet to be transmitted
as quickly as possible, the node persistently listens to the medium if its
free
 Energy consumption is not high – listening simply accepting
electromagnetic signals, amplify, process…to see if medium is free

 Persistent – if energy is less priority for the application rather than


latency then, the protocol is called persistent

13
CSMA MAC Protocol
 Non – persistent
 A node does not continually sense a channel for the
purpose of seizing it immediately upon detecting the end of
the previous transmission
 Node is not in hurry to transmit a packet--- that means , it
tries to listen if the medium is occupied,
 it postponed the transmission for some other periodic time
 And then, at some random time in the future, listen to the
medium again
… this how non-persistent MAC protocol algorithm works
 Energy efficiency is more important than latency,
 A trade-off can be achieved by implementing p-persistent

14
CSMA MAC Protocol
 Summary of the Non-persistent CSMA Operation

15
CSMA MAC Protocol
 1- persistent
 Never allows the channel to remain idle if a node is ready
to transmit

 Based this scheme, a node ready to transmit a data


packet first senses the channel. If the channel is free, the
node transmits its message immediately

 If the channel is busy, however, the node persistently


continues to listen until the channel becomes idle.

 Transmission is attempted immediately after the channel is


sensed idle.

16
CSMA MAC Protocol
 Summary of the 1-Persistent CSMA Operation

17
CSMA MAC Protocol
 P-persistent
 The p-persistent algorithm represents a compromise between the
nonpersistent and 1-persistent schemes
 Based on this algorithm, a node that senses the channel idle
transmits its packet with probability p.
 With probability (1-p), the station waits for a specific time period
before attempting to transmit the packet again
 Means, a node persists to listen to the medium with a probability
of 1 – p, it goes to sleep
 Depending on the balance to achieve between energy efficiency
and latency, p can be determined…
o If latency is more important, then p could be more greater than 0.5
o If energy if more important, then p could be below 0.5
How does this work????????????
18
CSMA MAC Protocol
 Imagine we have 4 sensors nodes and wish to have these
sensors fully connected in a WSN
 A packet originating from any of these sensor nodes can
reach any of other sensor nodes
 Then, they need to be within certain range
 Ideally, this is how the nodes should be placed

19
CSMA MAC Protocol
 Assuming that sensor nodes have same – hardware and software
configurations --- the goal is to achieve the arbitration in as far as
medium is concerned without centralized node
 All sensor nodes here are equal--no node will assume the role of
centralized node
 Hence transmission range and power consumption is the same

20
CSMA / CA
 Establishes a brief handshake between the sender and the
receiver before actual data transmission takes place
 The handshake begins when the sender sends a short
Request-to-Send (RTS) packed; the receiver then replies
with a Clear-to-send (CTS) packet.

 A node farther away from the sender may not receive its
RTS during carrier sense, it will, however, receive the CTS
which prompts it to back off.

 Collision on RTS/CTS packets is not expensive, but on


DATA packet is
What happens when simply listens????? –
21
CSMA / CA

 When A communicates, only B can listen to it, C can not listen to it


 So, if A is transferring packets to B and B is simply receiving then C
will not know that A is communicating with B
 Assuming that the medium is free, if C also begins to communicate,
 C can reach B, A can reach B, then collision can happen at B

22
CSMA / CA

 Similarly, D will never be able to listen to A then D can communicate


with C
 If C sends ACK, and C is in communication range with B and
electromagnetic waves moves 360 deg. In every direction
 The ACK from C will reach B as well
 Useful packets from A to B and ACK packets from C will collide at B
Listening to the medium is not sufficient!!!!!
How can A & C indirectly know what is going on???

23
CSMA / CA – Handshake Principle

 Before actual communication can take place, A can send a RTS if the
medium is free to B – B knows whether C is active or not, determine
whether the medium is free
 When B sends a CTS , both A and C will be able to receive it--- C will
interpret that medium is busy, hence refrain from sending
 This type of communication handshake increase listening range of A
by way of B
 Packets needed for this purpose are called Control Packets – Very
insignificant…..

24
CSMA / CA - RTS/CTS illustration

S1 & S2 – Transmitters
R - Receiver

S1 and S2 both wish to communicate with R


S1 can not determine if S2 is busy or not…
By use of control packets… S1 listens for the medium amount of time, if its
free, sends RTS to R
R has better knowledge about environment because it listens to both sides
– IF medium on both sides is free… sends out CTS

25
CSMA / CA - RTS/CTS illustration

S1 & S2 – Transmitters
R - Receiver

CTS goes in both direction…Indirectly S2 will know that R is communicating


with someone …therefore refrains to see medium
If CTS arrives, data communication can take place
When coms ends, R sends ACK…ACK travels in both directions like CTS
For S2, ACK is signal that coms between S1 and R is finished– CAN now
can CONTEND to seize medium…
Simple, distributed ALGORITHM …Wi-Fi, Bluetooth & WSN operates

26
CSMA / CA
How does this take place – Technically????? Recall…….
WS node is both transmitter and Receiver … has one
antenna!
For Transmission and Receiving it uses one antenna
Components for TX and RX are different

Therefore…
When S1 sends RTS its in Transmission mode and when it
Receives CTS, in receiving mode
That means, there is a time difference needed for switching
between transmission and receiving
SIFS is required to do the adjustment –[Short Inter-frame Spaces]

27
CSMA / CA
CCA: Clear Channel Access
RBO: Random Back Off
SIFS: Short Inter-frame Spaces

1. In the beginning, node listens if the medium is free—depicted by CCA


2. A node listens to its environment…measuring if signal is above a certain
threshold or below for some time
3. Below threshold for some time --- medium is free!
4. But should not jump to communicate immediately…WHY ? Another node
may be listening at same time…
5. To avoid collision, both should RBO
6. Meaning? For two to communicate pick 1 number from 0-10 e.g. 6
randomly
7. Another node 2 pick 1 No. from 0-6 e.g. 3
28
CSMA / CA
CCA: Clear Channel Access
RBO: Random Back Off
SIFS: Short Inter-frame Spaces

Both count down…..


Node 2 count more quickly – picked 3, means it has medium
first!
Node 1 will listens again, determine that medium is occupied by
Node 2… has to wait for next time
Therefore, RBO ensures that COLLISION does not occur
nodes which received CCA at the same time
29
CSMA / CA
CCA: Clear Channel Access
RBO: Random Back Off
SIFS: Short Inter-frame Spaces

 Recall at CCA, it was listening, now switch the radio to transmitting…


 SIFS is needed for switching process of the radio
 After RTS, it has to listen for arrival of CTS…it has to switch its radio back to
receiving mode…and time needed for that is SIFS
 If CTS -- channel free, node has to switch back to TX mode, after which data is
transmitted
 In order to know if packets have arrived successfully, -- Switches back to Rx mode
to receive ACK
 With arrival of ACK, transmission is complete and node can start to compete for
the medium all over again

30
CSMA / CA
More pictorially, this is what happens
We have 2 sensor nodes that wishes to communicate to
each other

31
CSMA / CA

S1 sense free medium, sends RTS, takes sometime to reach the receiver–
RX is in receiving mode
If medium free, it will switch back to TX and sends CTS to S1– at the same
time S2 will also listen to the CTS message
S2 will indirectly know that S1 is going to communicate
S2 can approximate how long this coms will take place– during the time it
can switch off radio and sleep to save energy
Only to wake up at the time to receive ACK packets and know that coms
between S1 and R is over and seizes the medium – energy is saved!

32
CSMA / CA
 What happens if two sensor nodes sense free medium at
the same time????

 If both S1 and S2 senses CCA and RBO at the same time, will send
CTS and there will be collision
 R will send CTS – again both have to sense a free medium, meaning,
CCA has to be conducted plus RBO..

33
CSMA / CA

This time, the probability of them choosing RBO time will be different– one
of them ( S1 & S2) will sense medium free first
In this case, S2 will pickup CTS, assuming it has picked a longer RBO time
and immediately know that coms is taking place and refrain from
communicating
Sleep to save medium
Between S1 and R, will follow procedure and commences to successfully
transfer data packets

34
Exposed Terminal of MAC Protocol
 while node B is transmitting to node A, node C has a packet intended
for node D.
 Because node C is in range of B, it senses the channel to be busy and
is not able to send.
 However, in theory, because D is outside of the range of B, and A is
outside of the range of C, these two transmissions would not collide
with each other.
 The deferred transmission by C causes bandwidth wastage.

A B C D

Ad hoc & sensor networs - Ch 5: MAC protocols 35


Hidden Terminal of MAC Protocol
 Node A is transmitting to node B. Node C, which is out of
the radio range of A, will sense the channel to be idle and
start packet transmission to node B too.
 In this case CSMA fails to avoid the collision because A
and C are hidden to each other

A B C D

Ad hoc & sensor networs - Ch 5: MAC protocols 36


Comparison – CSMA/CA & TDMA
 CSMA/CA minimizes collision, but does not completely
eliminate collision
 By Contrast, TDMA avoids collision completely, assuming
that, there is strictly time synchronization, but the cost of time
synchronization is higher than cost of transmitting packets
 So even if collision occurs with CSMA, either they are
occurring on control packets, the size is very small,
 Even if packets collision happens on data packets, still the
probability is low--- its affordable
 The freedom of implementing should be distributed –
distributed is more important
 Nodes will decided by themselves, medium is shared fairly
and probability of collision occurring is relatively low

37
summary

 Introduction of CSMA protocol – introduced, human,


wireless and wired
 Nonpersistent- Sense medium busy, back off random time
 1-persistent
 CSMA/CA protocol
 RTS/CTS handshake principles
 Illustrations of RTS/CTS protocols
 Exposed and Hidden Terminal Problem
 Comparison of CSMA/CA and TDMA protocols

38
The End.

Thanks for your attention!!

39

You might also like