MAC Protocol

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 36

चरैवेति, चरैवेति

Keep progressing to attain a higher


self.

avinash.bhagat@lpu.co.in Avinash Bhagat


CAP275: Data Communication and
Networking

Lecture # 20
MAC Protocols

avinash.bhagat@lpu.co.in Avinash Bhagat


Data Link Layer
LLC and MAC sublayers
Multiple Access

Problem: When two or more nodes transmit at the same


time, their frames will collide and the link bandwidth is
wasted during collision
 How to coordinate the access of multiple sending/receiving
nodes to the shared link???
Solution: We need a protocol to coordinate the transmission
of the active nodes
Multiple Access

What is expected from Multiple Access Protocols:

Main task is to minimize collisions in order to utilize the bandwidth


by:

Determining when a station can use the link (medium)


what a station should do when the link is busy
what the station should do when it is involved in collision
Multiple Access

For wireless
Random Access
Random Access (or contention based ) Protocols:

No station is superior to another station and none is assigned the


control over another.

No station permits, or does not permit,


another station to send.

At each instance, a station that has data to send uses a procedure


defined by the protocol.
Random Access  ALOHA
Protocols

Pure ALOHA Protocol


Slotted ALOHA Protocol
Pure ALOHA Protocols

All frames from any station are of fixed length (L bits)

Stations transmit at equal transmission time (all stations produce


frames with equal frame lengths).

A station that has data can transmit at any time


Pure ALOHA Protocols

After transmitting a frame, the sender waits for an


acknowledgment for an amount of time (time out) equal to the
maximum round-trip propagation delay

If no ACK was received, sender assumes that the frame or


ACK has been destroyed and resends that frame after it waits
for a random amount of time
Procedure for pure ALOHA
protocol

12
Frames in a pure ALOHA
network
Pure ALOHA Protocols

If station fails to receive an ACK after repeated transmissions, it gives up

ALOHA Maximum channel utilization is 18%


Vulnerable time for pure ALOHA
protocol
Random Access – Slotted ALOHA

Time is divided into slots equal to a frame transmission time (Tfr)

A station can transmit at the beginning of a slot only

If a station misses the beginning of a slot, it has to wait until the beginning of the next time
slot.

A central clock or station informs all stations about the start of a each slot

Maximum channel utilization is 37%


Frames in a Slotted ALOHA network

17
Vulnerable time for Slotted ALOHA protocol

18
Advantage of ALOHA protocols

A node that has frames to be transmitted can transmit continuously at the full rate of
channel (R bps) if it is the only node with frames
Simple to be implemented
No master station is needed to control the medium
Disadvantage

If (M) nodes want to transmit, many collisions can occur and the rate allocated for each
node will not be on average R/M bps
 This causes low channel utilization 36.8% and 18.4%
Random Access – Carrier Sense Multiple Access
(CSMA)
Random Access – Carrier Sense Multiple Access
(CSMA)
 Vulnerable time for CSMA is the maximum propagation time

 The longer the propagation delay, the worse the performance of the protocol because of the
above case.
Types of CSMA Protocols

1. Non-Persistent CSMA
2. 1-Persistent CSMA
3. p-Persistent CSMA
Flow diagram for three persistence methods
Nonpersistent CSMA

 A station with frames to be sent, should sense the medium


1. If medium is idle, transmit; otherwise, go to 2

2. If medium is busy, (backoff) wait a random amount of time and repeat 1


1-persistent CSMA

 To avoid idle channel time, 1-persistent protocol used


 Station wishing to transmit listens to the medium:
1. If medium idle, transmit immediately;
2. If medium busy, continuously listen until medium becomes idle; then transmit immediately with probability 1
 Performance
 1-persistent stations are selfish
 If two or more stations becomes ready at the same time, collision guaranteed
P-persistent CSMA

 Time is divided to slots where each Time unit (slot) typically equals maximum propagation delay
 Station wishing to transmit listens to the medium:
1. If medium idle,
 transmit with probability (p), OR
 wait one time unit (slot) with probability (1 – p), then repeat 1.
2. If medium busy, continuously listen until idle and repeat step 1
3. Performance
 Reduces the possibility of collisions like nonpersistent
 Reduces channel idle time like 1-persistent
Persistent and Nonpersistent CSMA

Comparison of the channel utilization versus load for various random


access protocols.
CSMA/CD (Collision Detection)

 CSMA (all previous methods) has an inefficiency:


 If a collision has occurred, the channel is unstable until colliding packets have

been fully transmitted

 CSMA/CD (Carrier Sense Multiple Access with Collision Detection) overcomes this
as follows:
 While transmitting, the sender is listening to medium for collisions.

 Sender stops transmission if collision has occurred reducing channel wastage .

CSMA/CD is Widely used for bus topology LANs (IEEE 802.3, Ethernet).
CSMA/CD (Collision Detection)
Collision and abortion in CSMA/CD

31
Flow diagram for CSMA/CA

32
Flow diagram for the CSMA/CD

33
CSMA/CD (CSMA with Collision Detection)

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 repeats the same algorithm
References :

Text Book:
1. Behrouz A. Forouzan, Data Communication and
networking, 4th Ed., Tata McGraw Hills year of
publication 2006
Other Specific Book:
1. Andrew S. Tanenbaum,Computer Network 2nd
Edition, PHI, Third Edition 1997
2. Comer E. Doughlas,Computer Networks and
Internets, 2nd Ed., Pearson, 2000
3. W. Stallings,Data and Computer Communications, 7th
Ed., Pearson, 2002.
See you in next class

You might also like