0% found this document useful (0 votes)
10 views63 pages

CSMA

The document provides an overview of the Medium Access Control (MAC) sublayer of the Data Link Layer in the OSI model, detailing its functions such as frame preparation, addressing, access control, collision handling, and error checking. It discusses various multiple access protocols, including random access protocols like ALOHA and CSMA, as well as controlled access protocols like reservation and polling. The document emphasizes the importance of MAC addresses and the role of different protocols in managing data transmission and minimizing collisions in shared network environments.

Uploaded by

vishwaranjan41
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)
10 views63 pages

CSMA

The document provides an overview of the Medium Access Control (MAC) sublayer of the Data Link Layer in the OSI model, detailing its functions such as frame preparation, addressing, access control, collision handling, and error checking. It discusses various multiple access protocols, including random access protocols like ALOHA and CSMA, as well as controlled access protocols like reservation and polling. The document emphasizes the importance of MAC addresses and the role of different protocols in managing data transmission and minimizing collisions in shared network environments.

Uploaded by

vishwaranjan41
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

Unit3: Data Link Layer(10)

Chapter 1: Medium Access Control Sublayer

Introduction to Mac layer-Multiple Access protocols-Types of MAC protocols:


Random Access Protocols-ALOHA, CSMA, CSMA/CD, CSMA/CA Controlled
Access Protocols:-Reservation, Polling, Token passing, Channelization Protocols.
Medium Access Control (MAC) is part of the Data Link Layer in the OSI model.

● It makes sure that devices share the network fairly and avoid data collisions.

● It controls when and how each device can send data on a shared network.

● It handles flow control (not sending data too fast) and multiplexing (letting
multiple signals share the same channel).

● It works through the network interface card (NIC) to send data.

Multiplexing:-To save bandwidth


To reduce cost
To increase efficiency
To support simultaneous communication
Functions of the MAC Layer

1. Bridge between layers


The MAC layer sits between the Physical layer and the upper layers.
It helps the upper layers (which deal with data and protocols) to communicate with the
physical hardware, so they don’t have to worry about how signals are actually sent over cables
or air.

2. Frame preparation
Before sending data, the MAC layer organizes the data into a proper format called a frame.
A frame contains not only the actual data but also control information like addresses and
error‐checking bits.

3. Addressing
To make sure the frame reaches the right device, the MAC layer adds the sender’s and
receiver’s MAC addresses.
It is similar to writing the “From” and “To” addresses on an envelope before posting a letter.
4. Access control
When many devices share the same medium (e.g., LAN, Wi-Fi), the MAC layer decides
whose turn it is to send data.
This avoids everyone talking at the same time.

5. Collision handling
Sometimes two devices may still transmit at the same time, which causes a collision.
The MAC layer detects it, waits for a random time, and retransmits the data to resolve
the conflict.

6. Error checking
Before sending the frame, the MAC layer adds a Frame Check Sequence (FCS) for
detecting transmission errors.
When the receiver receives the frame, it checks this FCS to verify if the data is correct. If
there is an error, the frame is rejected and can be sent again.
MAC Address

● A MAC address (Media Access Control address) is a unique ID given to


every device’s network card (NIC).

● It is used as the device’s address for sending and receiving data within a
local network (like Ethernet, Wi-Fi, or Bluetooth).

● It is built into the NIC during manufacturing and cannot be changed easily.

● It has 6 groups of two hexadecimal numbers (0–9, A–F) separated by colons,


hyphens, or sometimes nothing.

● Example: 00:0A:89:5B:F0:11.
Multiple access protocols are a set of protocols operating in the Medium Access Control sublayer (MAC
sublayer) of the Open Systems Interconnection (OSI) model. These protocols allow a number of nodes or
users to access a shared network channel. Several data streams originating from several nodes are
transferred through the multi-point transmission channel.
The objectives of multiple access protocols are optimization of transmission time, minimization of
collisions and avoidance of crosstalks.
Random Access Protocols
Random access protocols assign uniform priority to all connected
nodes. Any node can send data if the transmission channel is idle. No
fixed time or fixed sequence is given for data transmission.
The four random access protocols are−

ALOHA
Carrier sense multiple access (CMSA)
Carrier sense multiple access with collision detection (CMSA/CD)
Carrier sense multiple access with collision avoidance (CMSA/CA)
Pure ALOHA Devices transmit whenever they have data. Send whenever you have data
Very simple but has high collision probability. (don’t check the channel).
Collisions may happen often.

Slotted ALOHA Time is divided into slots. Devices can only Time is divided into slots. You
send at the beginning of a time slot, which are allowed to speak only at the
reduces collisions. beginning of a slot.

CSMA A device listens to the channel before it sends. Listen first. If the channel is free
If the channel is free → it transmits. If busy → it → send. If busy → wait.
waits.

CSMA/CD Used in wired networks (Ethernet). Device Listen first and keep listening
listens before transmitting and keeps listening while talking. If collision happens
while transmitting. If a collision is detected → → stop immediately, wait, and try
transmission stops immediately. again.

CSMA/CA Used in wireless networks (Wi-Fi). A device Try to avoid collision by waiting a
waits a random back-off time even if the random back-off time even when
channel is free to avoid collision. It also may the channel is free. Might also
send a Request To Send (RTS) before data. send RTS before sending data.
Pure Aloha
The mode of random access in which users can transmit at any time is called pure Aloha. This technique is
explained below in a stepwise manner.
Step 1 In pure ALOHA, the nodes transmit frames whenever there is data to send.
Step 2 When two or more nodes transmit data simultaneously, then there is a chance of collision and the
frames are destroyed.
Step 3 In pure ALOHA, the sender will expect acknowledgement from the receiver.
Step 4 If acknowledgement is not received within specified time, the sender node assumes that the frame
has been destroyed.
Step 5 If the frame is destroyed by collision the node waits for a random amount of time and sends it again.
This waiting time may be random otherwise the same frames will collide multiple times.
Step 6 Therefore, pure ALOHA says that when the time-out period passes, each station must wait for a
random amount of time before re-sending its frame. This randomness will help avoid more collisions.
In PURE ALOHA, the vulnerable period is two slot times.(ie. 2 x transmission time)
Vulnerable period is the maximum interval over which two packets can overlap and destroy each other.
Slotted ALOHA
The slotted ALOHA is explained below in stepwise manner −

Step 1 − Slotted ALOHA was introduced to improve the efficiency of pure ALOHA, because in pure
ALOHA there is a high chance of collision.

Step 2 − In this protocol, the time of the shared channel is divided into discrete intervals called as slots.

Step 3 − The stations can send a frame only at the beginning of the slot and only one frame is sent in
each slot.

Step 4 − In slotted ALOHA, if any station is not able to place the frame onto the channel at the beginning
of the slot i.e. it misses the time slot then the station has to wait until the beginning of the next time slot.

Step 5 − In slotted ALOHA, there is still a possibility of collision if two stations try to send at the beginning
of the same time slot.

Step 6 − The users are restricted to transmit only from the instant corresponding to the slot boundary.
Carrier Sense Multiple Access (CSMA) is a method used in computer networks to help devices share a communication
channel without interfering with each other.

Step 1
Each device checks (listens to) the channel before sending any data.

Step 2 (Random back-off time = a


If the channel is busy, the device waits until it becomes idle. randomly selected waiting time
used after a collision before trying
Step 3
If the channel is idle, the device starts transmitting its data. to send the data again.)

Step 4
While transmitting, the device continues to monitor the channel to detect if a collision occurs.

Step 5
If no collision is detected, the transmission is considered successful.

Step 6
If a collision is detected, the device stops transmission immediately.

Step 7
Then the device waits for a random back-off time and tries again from Step 1.
CSMA/CD
CSMA/CD (Carrier Sense Multiple Access with Collision Detection) is a method used in
networks to share the same communication channel.

● Before sending data, each computer (station) listens to the channel to check if it is free.

● If the channel is free → it starts sending the data.

● If two computers send at the same time → a collision happens.

● The computers detect the collision, stop sending, wait for a random time, and then try
again.
How Does CSMA/CD Work? Step 4: Success
Step 1: Check readiness ● If no collision occurs → the data is sent
● The computer (sender) is ready with data to send. successfully.

Step 2: Listen to the channel ● The sender then resets and gets ready
● The sender checks if the communication line (link) is
for the next transmission.
free.

● If it’s busy → wait. Ready → Listen → Send → If collision →


● If it’s free → start sending data.
Stop, wait, and retry → Else done.

Step 3: Send data & watch for collision

● While sending, the sender keeps checking for


collisions.

● If a collision happens (two senders send at the same


time):

○ Stop sending immediately.

○ Send a jam signal (to inform all others).

○ Wait for a random time before trying again.


Features of CSMA/CD:
1. Carrier Sense

○ Before sending, each device listens to the channel.

○ If it’s busy → wait.

○ If it’s free → send.

2. Multiple Access

○ Many devices share the same channel.

○ Any device can send when the channel is free.

3. Collision Detection

○ If two devices send at the same time → a collision happens.

○ Devices stop sending and send a jam signal to alert others.

○ Then, they wait for a random time before trying again.


4. Backoff Algorithm

● After a collision, each device waits for a random time (not fixed) before retransmitting.

● This reduces the chance of another collision.

5. Minimum Frame Size

● Data packets must be of a minimum length.

● This ensures collisions are detected before a packet finishes sending.

● If packets are too short → collisions may go unnoticed → corrupted data.


Advantages of CSMA/CD

1. Simple and Common

○ Easy to understand and use.

2. Fair Access

○ All devices get an equal chance to send data.

3. Efficient Use of Channel

○ Reduces collisions.

○ Prevents congestion, so the channel is used effectively.


Disadvantages of CSMA/CD
1. Limited Scalability
Sniffing = listening/stealing
● Not suitable for very large networks with many devices.
data.

2. Collisions Still Happen Spoofing = faking/pretending in


data.
● CSMA/CD can detect collisions but cannot stop them.

● Collisions cause delays and reduce performance.

3. Bandwidth Wastage

● The random waiting (backoff) after collisions can waste network bandwidth.

4. No Security

● CSMA/CD has no built-in security.

● Vulnerable to attacks like packet sniffing and spoofing.


CSMA/CA
CSMA/CA (Carrier Sense Multiple Access with Collision Avoidance)
● Works at the MAC (Medium Access Control) layer.

● Unlike CSMA/CD, which detects collisions after they happen, CSMA/CA tries to avoid
collisions before they happen.

● Working:

○ Devices first check if the channel is free.

○ They may also send a short signal (like “I’m about to send”) before sending the actual
data.

○ This reduces the chances of two devices sending at the same time.
The algorithm of CSMA/CA is:

When a frame is ready, the transmitting station checks whether the channel is idle or busy.
If the channel is busy, the station waits until the channel becomes idle.
If the channel is idle, the station waits for an Inter-frame gap (IFG) amount of time and then sends the
frame.
After sending the frame, it sets a timer.
The station then waits for acknowledgement from the receiver. If it receives the acknowledgement
before expiry of timer, it marks a successful transmission.
Otherwise, it waits for a back-off time period and restarts the algorithm.
Advantages
● Helps prevent data collisions
● Thanks to feedback, no data is unnoticeably lost
● Avoids unnecessary data traffic with the RTS/CTS(Request to
Send / Clear to Send) extension

Disadvantages
● Longer waiting times
● Solves the hidden station problem only by using RTS/CTS
extension
● Creates the exposed station problem through using RTS/CTS
RTS/CTS (Request to Send / Clear to Send)
It’s a handshaking method used in wireless networks (like Wi-Fi) to
avoid collisions.
1. RTS (Request to Send) –
The sender first asks permission before sending data.

2. CTS (Clear to Send) –


The receiver replies with a “yes” signal if the channel is free.

3. Data Transmission –
Only after receiving CTS, the sender sends the actual data.
Control access protocol is a protocol where all the stations have to
consult each other to find out which station holds the right to send
data. This will ultimately help avoid the collision of data.
Controlled Access Protocols in Computer Network
In controlled access protocol, there are certain stations that will seek information from each other in order to
check which station holds the right to send the [Link] may only allow one node for sending the data at a time so
as to avoid the collision of all the messages shared by that medium.

These protocols generally lie below certain categories having the controlled access. These categories will
include:

Reservation,
Polling,
Token passing
Reservation

In the reservation, a station may need to create the reservation before it sends the data.
We will perform the following steps:

● Firstly divide time in form of intervals


● In each of the intervals, reservation frames may forgo data frame sent to that
particular interval
● If there are “N” number of stations present in the system, there will be precise
“N” minislot reservations, where each of the minislot will belong to the station
● Whenever any station may require you to send the data frame, it can make the
reservation in the mini slots
● Then, all the stations with the reservations can easily send data in the reservation
frame
How it works
1. Time is divided into two parts:

○ Reservation interval (fixed time, divided into slots – one for each station).

○ Data transmission period (actual data is sent).

2. If a station wants to send data:

○ It marks “1” in its slot during the reservation interval.

○ This tells everyone it wants to send.

3. After all slots are checked:

○ Stations know who wants to send.

○ They take turns in the order of slots (no collisions).


Advantages
Predictable access

● Time slots are fixed → stations know when they can send data.

● Easy to predict data access time.

Priorities possible

● Important stations (like voice/video) can get faster access.

Better performance

● Network runs smoothly because no collisions.

● Good for real-time apps (video calls, streaming) where delay must be low.
Less competition

● Since access is already reserved, stations don’t fight for the channel.

● Reduces packet loss.

Supports Quality of Service (QoS)

● Different traffic (voice, video, data) can get different reservations.

● High-priority traffic is served first.

Efficient use of bandwidth

● Multiple users can share the same channel by dividing time/frequency.

Best for multimedia

● Works well for apps that need guaranteed resources like bandwidth and low delay (e.g., video streaming, online gaming).
Disadvantages
● Depends on central control (needs a reliable system).

● Wastes time when traffic is low (slots are reserved but unused).

● Can increase waiting time (turn-around delay).


Polling

This method generally works with the help of topologies where one device will act as the primary station
while the other devices will act as secondary stations.

● Firstly all type of data exchanges will be done through primary device with second device as
destination
● In order to impose the order on networks, users have to establish one station which will act as
controller. While the other stations will be acting as polling
● Here the primary device will control link with the secondary station device which will follow the
instructions of the primary device
● Though, the main responsibility will be on the primary device which will determine if the channel
need to be used or not
● Therefore all kind of primary device will be the initiator of all sessions
Select Function:

The select function is utilized when the primary device wants to send data to a
secondary device.
● The primary device sends a "select" frame to a specific secondary device, informing it
that the primary is about to transmit data and asking the secondary to prepare to receive.
● The secondary device, upon receiving the select frame, responds with an
Acknowledgment (ACK) if it is ready to receive.
● Upon receiving the ACK, the primary device then proceeds to transmit the data to the
selected secondary device.
The poll function is utilized when the primary device wants to receive data from a
secondary device.
● The primary device, acting as the controller, sends a "poll" frame to a specific secondary
device, essentially asking, "Do you have any data to send?"
● If the secondary device has data, it responds by sending its data frame.
● If the secondary device has no data, it typically responds with a Negative Acknowledgment
(NAK) frame.
● The primary device then processes the received data (if any) and acknowledges it, or
proceeds to poll the next secondary device in sequence if the current one had no data.
● Poll function: Primary asks secondary if it has data to send.
● Select function: Primary tells secondary that it (the primary) has
data to send.
Token Passing
Token Passing In the token-passing method, the stations in a network are organized in a logical ring.
In other words, for each station, there is a predecessor and a successor.

● The predecessor is the station which is logically before the station in the ring;
● The successor is the station which is after the station in the ring.
● The current station is the one that is accessing the channel now.

The right to this access has been passed from the predecessor to the current station. The right will
be passed to the successor when the current station has no more data to send.
In this method, a special packet called a token circulates through
the ring.
The possession of the token gives the station the right to access
the channel and send its data.
When a station has some data to send, it waits until it receives the
token from its predecessor. It then holds the token and sends its
data.
Logical Ring In a token-passing network, stations do not have to be physically
connected in a ring; the ring can be a logical one.
In the Physical Ring Topology, when a station sends the token to its
successor, the token cannot be seen by other stations; the successor is
the next one in line. This means that the token does not have to have
the address of the next successor. The problem with this topology is
that if one of the links-the medium between two adjacent stations fails,
the whole system fails. The dual ring topology uses a second
(auxiliary) ring which operates in the reverse direction compared with
the main ring. The second ring is for emergencies only (such as a spare
tire for a car). If one of the links in the main ring fails, the system
automatically combines the two rings to form a temporary ring. After
the failed link is restored, the auxiliary ring becomes idle again.
In the Bus Ring Topology, also called a token bus, the stations
are connected to a single cable called a bus. They, however,
make a logical ring, because each station knows the address of
its successor (and also predecessor for token management
purposes). When a station has finished sending its data, it
releases the token and inserts the address of its successor in the
token. Only the station with the address matching the
destination address of the token gets the token to access the
shared media.
In a Star Ring Topology, the physical topology is a star. There
is a hub, however, that acts as the connector. The wiring inside
the hub makes the ring; the stations are connected to this ring
through the two wire connections. This topology makes the
network less prone to failure because if a link goes down, it
will be bypassed by the hub and the rest of the stations can
operate.
Advantages of Token passing

● No Collisions → Only the station with the token can send, so data doesn’t collide.

● Fair Access → Every station gets a chance when the token comes around.

● Efficient in Heavy Load → Works well when many stations want to send data (unlike CSMA/CD).

● Predictable → Access time is fixed since the token circulates in order.

Disadvantages of Token passing

● Its cost is expensive.


● Topology components are more expensive than those of other, more widely used standard.
● The hardware element of the token rings are designed to be tricky. This implies that you should choose on manufacture and
use them exclusively.
Channelization Protocols

Channelization is basically a method that provides the multiple-access and in this, the
available bandwidth of the link is shared in time, frequency, or through the code in between
the different stations.

Channelization Protocols are broadly classified as follows:

● FDMA(Frequency-Division Multiple Access)


● TDMA(Time-Division Multiple Access)
● CDMA(Code-Division Multiple Access)
Frequency-Division Multiple Access

With the help of this technique, the available bandwidth is divided into frequency bands.
Each station is allocated a band in order to send its data. Or in other words, we can say that
each band is reserved for a specific station and it belongs to the station all the time.

● Each station makes use of the bandpass filter in order to confine the frequencies of the
transmitter.
● In order to prevent station interferences, the allocated bands are separated from one
another with the help of small guard bands.
● The Frequency-division multiple access mainly specifies a predetermined frequency
for the entire period of communication.
● Stream of data can be easily used with the help of FDMA.
2. Time-Division Multiple Access

Time-Division Multiple access is another method to access the channel for shared medium networks.

● With the help of this technique, the stations share the bandwidth of the channel in time.
● A time slot is allocated to each station during which it can send the data.
● Data is transmitted by each station in the assigned time slot.
● There is a problem in using TDMA and it is due to TDMA the synchronization cannot be achieved between
the different stations.
● When using the TDMA technique then each station needs to know the beginning of its slot and the location
of its slot.
● If the stations are spread over a large area, then there occur propagation delays; in order to compensate this
guard, times are used.
● The data link layer in each station mainly tells its physical layer to use the allocated time slot.
3. Code-Division Multiple Access
CDMA(code-division multiple access) is another technique used for channelization.

● CDMA technique differs from the FDMA because only one channel occupies the entire bandwidth of the
link.
● The CDMA technique differs from the TDMA because all the stations can send data simultaneously as
there is no timesharing.
● The CDMA technique simply means communication with different codes.
● In the CDMA technique, there is only one channel that carries all the transmission simultaneously.
● CDMA is mainly based upon the coding theory; where each station is assigned a code, Code is a
sequence of numbers called chips.
● The data from the different stations can be transmitted simultaneously but using different code
languages.
Try our new interactive courses.
1. FDMA (Frequency Division Multiple Access)
Each user gets a separate frequency band.
Advantages
● Simple to implement.

● No synchronization needed between users.

● Less delay since channels are always available.

Disadvantages
● Wastes bandwidth due to guard bands.

● Limited number of users (depends on frequency slots).

● Less flexible compared to TDMA and CDMA.


2. TDMA (Time Division Multiple Access)
Each user gets the same frequency but at different time slots.
Advantages
● More users can share the same bandwidth compared to FDMA.

● No guard band needed, so spectrum is used efficiently.

Disadvantages
● Requires precise synchronization between users.

● Delay may occur if a user must wait for a time slot.

● Performance degrades with more users.


3. CDMA (Code Division Multiple Access)
All users share the same frequency and time but use unique codes.

Advantages

● High capacity (supports more users than FDMA/TDMA).

● Strong security (signals are encoded).

● Resistant to interference

Disadvantages

● Complex implementation (needs powerful signal processing).

● Near–far problem: strong signals can overpower weak ones (requires power control).
Features FDMA (Frequency Division TDMA (Time Division CDMA (Code Division
Multiple Access) Multiple Access) Multiple Access)

Acronym FDMA is an acronym for TDMA is an acronym CDMA is an acronym


"Frequency Division Multiple for "Time Division for "Code Division
Access". Multiple Access". Multiple Access".

Mode of Operation It distributes bandwidth It shares the time of It shares time and
among stations by dividing it transmission through bandwidth using unique
into sub-channels. satellite, not the codes for each slot.
channel.

Codeword There is no need of any There is no need for Codeword is


codeword. any codeword. necessary.

Cost It has a high installation It has a low installation It has a high installation
cost. cost. cost, but low
operational cost.

Guard times and It requires guard bands. It requires guard times. It requires both guard
Bands times and guard bands.

You might also like