Medium Access Control
Medium Access Control
SubLayer
2
Dr. Kumkum Saxena MAC Sub Layer page 2
Introduction
Network Layer
Logical Link Control (LLC)
Data Link Layer
Medium Access Control (MAC)
Physical Layer
10
Dr. Kumkum Saxena MAC Sub Layer page 10
Dr. Kumkum Saxena MAC Sub Layer page 11
Random Access Protocols
It is also called Contention Method.
In this method, there is no control station.
Any station can send the data.
The station can make a decision on whether or not to
send data. This decision depends on the state of the
channel, i.e. channel is busy or idle.
There is no scheduled time for a stations to transmit.
They can transmit in random order.
12
Dr. Kumkum Saxena MAC Sub Layer page 12
Random Access Protocols
There is no rule that decides which station should
send next.
If two stations transmit at the same time, there is
collision and the frames are lost.
The various random access methods are:
ALOHA
13
Dr. Kumkum Saxena MAC Sub Layer page 13
ALOHA
ALOHA was developed at University of Hawaii in early
1970s by Norman Abramson.
It was used for ground based radio broadcasting.
In this method, stations share a common channel.
When two stations transmit simultaneously, collision
occurs and frames are lost.
There are two different versions of ALOHA:
Pure ALOHA
Slotted ALOHA
14
Dr. Kumkum Saxena MAC Sub Layer page 14
Pure Aloha
Assumptions
1. Continuous time
2. No carrier sense.
◼ Stations transmit whenever they have data to send.
◼ There will be collisions and the colliding frames will be destroyed.
◼ No feedback from receiver, hence the sender just waits for a random
amount of time and sends it again.
Note : Waiting time --→Random
(If uniform, then same frames will collide over and over)
16
Dr. Kumkum Saxena MAC Sub Layer page 16
Dr. Kumkum Saxena MAC Sub Layer page 17
Slotted Aloha
◼ Assumptions
Slotted time
◼
◼ No carrier sense
◼ Time is divided into equal size slots (= frame transmission
time)
◼ Stations transmit only at beginning of a time slot.
◼ If collision: retransmit frame in future slots.
19
Dr. Kumkum Saxena MAC Sub Layer page 19
Slotted Aloha
22
Dr. Kumkum Saxena MAC Sub Layer page 22
Carrier Sense Multiple Access(CSMA)
◼ Are protocols in which stations listen for a carrier (i.e.
transmission) and act accordingly.
Protocols
◼ 1 persistent CSMA
◼ Non persistent CSMA
◼ p persistent CSMA
◼ CSMA /CD
Sense carrier
Y Busy ?
Wait for
a slot N
Generate a Random
number.
number<p
N
Y
34
Dr. Kumkum Saxena MAC Sub Layer page 34
CSMA with Collision Detection
(CSMA/CD)
In CSMA/CD, the station that sends its data on the
channel, continues to sense the channel even after data
transmission.
If collision is detected, the station aborts its transmission
and waits for a random amount of time & sends its data
again.
As soon as a collision is detected, the transmitting station
release a jam signal.
Jam signal alerts other stations. Stations are not
supposed to transmit immediately after the collision has
occurred.
35
Dr. Kumkum Saxena MAC Sub Layer page 35
CSMA with Collision Avoidance
(CSMA/CA)
This protocol is used in wireless networks because
they cannot detect the collision.
So, the only solution is collision avoidance.
It avoids the collision by using three basic
techniques:
Interframe Space
Contention Window
Acknowledgements
36
Dr. Kumkum Saxena MAC Sub Layer page 36
CSMA with Collision Avoidance
(CSMA/CA)
37
Dr. Kumkum Saxena MAC Sub Layer page 37
Interframe Space
Whenever the channel is found idle, the station does not
transmit immediately.
It waits for a period of time called Interframe Space (IFS).
When channel is sensed idle, it may be possible that
some distant station may have already started
transmitting.
Therefore, the purpose of IFS time is to allow this
transmitted signal to reach its destination.
If after this IFS time, channel is still idle, the station can
send the frames.
38
Dr. Kumkum Saxena MAC Sub Layer page 38
Contention Window
Contention window is the amount of time divided into
slots.
Station that is ready to send chooses a random number
of slots as its waiting time.
The number of slots in the window changes with time.
It means that it is set of one slot for the first time, and
then doubles each time the station cannot detect an idle
channel after the IFS time.
In contention window, the station needs to sense the
channel after each time slot.
39
Dr. Kumkum Saxena MAC Sub Layer page 39
Acknowledgment
Despite all the precautions, collisions may occur and
destroy the data.
Positive acknowledgement and the time-out timer
helps guarantee that the receiver has received the
frame.
40
Dr. Kumkum Saxena MAC Sub Layer page 40
Binary exponential Back off algorithm
◼ CSMA/CD flowchart
Jam signal: A signal that carries a bit pattern sent by a data station to inform the other stations
that they must not transmit. In carrier-sense multiple access with collision detection (CSMA/CD)
networks, the jam signal indicates that a collision has occurred.
42
Dr. Kumkum Saxena MAC Sub Layer page 42
Reservation
44
Dr. Kumkum Saxena MAC Sub Layer page 44
Token Passing
Token passing method is used in those networks where the
stations are organized in a logical ring.
In such networks, a special packet called token is circulated
through the ring.
Station that possesses the token has the right to access the
channel.
Whenever any station has some data to send, it waits for the
token. It transmits data only after it gets the possession of token.
After transmitting the data, the station releases the token and
passes it to the next station in th ring.
If any station that receives the token has no data to send, it
simply passes the token to the next station in the ring.
45
Dr. Kumkum Saxena MAC Sub Layer page 45
Channelization Protocol
Channelization is a multiple access method in which
the available bandwidth of a link is shared in time,
frequency or code between different stations.
There are three basic channelization protocols:
Frequency Division Multiple Access (FDMA)
Time Division Multiple Access (TDMA)
Code Division Multiple Access (CDMA)
46
Dr. Kumkum Saxena MAC Sub Layer page 46
FDMA
• In FDMA, the available bandwidth is divided into frequency
bands.
• Each station is allocated a band to send its data.
• This band is reserved for that station for all the time.
• The frequency bands of different stations are separated
by small bands of unused frequency.
• These unused bands are called guard bands that prevent
station interferences.
• FDMA is different from FDM (Frequency Division
Multiplexing).
• FDM is a physical layer technique, whereas, FDMA is an
access method in the data link layer.
47
Dr. Kumkum Saxena MAC Sub Layer page 47
48
Dr. Kumkum Saxena MAC Sub Layer page 48
TDMA
In TDMA, the bandwidth of channel is divided among various
stations on the basis of time.
Each station is allocated a time slot during which it can send
its data.
Each station must know the beginning of its time slot.
TDMA requires synchronization between different stations.
Synchronization is achieved by using some synchronization
bits at the beginning of each slot.
TDMA is also different from TDM. TDM is a physical layer
technique, whereas, TDMA is an access method in data link
layer.
49
Dr. Kumkum Saxena MAC Sub Layer page 49
50
Dr. Kumkum Saxena MAC Sub Layer page 50
CDMA
Unlike TDMA, in CDMA all stations can transmit data
simultaneously.
CDMA allows each station to transmit over the entire
frequency spectrum all the time.
Multiple simultaneous transmissions are separated
using coding theory.
In CDMA, each user is given a unique code
sequence.
51
Dr. Kumkum Saxena MAC Sub Layer page 51
Working of CDMA
Let us assume that we have four stations: 1, 2, 3 and 4
that are connected to the same channel.
The data from station 1 is d1, from station 2 is d2 and so
on.
The code assigned to station 1 is c1, station 2 is c2 and so
on.
These assigned codes have two properties:
If we multiply each code by another, we get 0.
52
Dr. Kumkum Saxena MAC Sub Layer page 52
Working of CDMA
When these four stations send data on the same
channel, then station 1 multiplies its data by its code
i.e. d1.c1, station 2 multiplies its data by its code i.e.
d2.c2 and so on.
The data that goes on the channel is the sum of all
these terms:
d1.c1 + d2.c2 + d3.c3 + d4.c4
Any station that wants to receive data from the
channel multiplies the data on the channel by the
code of the sender.
53
Dr. Kumkum Saxena MAC Sub Layer page 53
Working of CDMA
◼ For e.g.: suppose station 2 wants to receive
data from station1.
◼ It multiplies the data on the channel by c1,
(code of station 1).
◼ Because (c1.c1) is 4, but (c2.c1), (c3.c1) and (c4.c1)
are all 0s, station 2 divides the result by 4 to get the
data from station 1.
c1 c2 c3 c4
[ +1 +1 +1 +1] [ +1 -1 +1 -1] [ +1 +1 -1 -1] [ +1 -1 -1 +1]
55
Dr. Kumkum Saxena MAC Sub Layer page 55
Working of CDMA
c1 c2 c3 c4
[ +1 +1 +1 +1] [ +1 -1 +1 -1] [ +1 +1 -1 -1] [ +1 -1 -1 +1]
56
Dr. Kumkum Saxena MAC Sub Layer page 56
Working of CDMA
c1 c2 c3 c4
[ +1 +1 +1 +1] [ +1 -1 +1 -1] [ +1 +1 -1 -1] [ +1 -1 -1 +1]
57
Dr. Kumkum Saxena MAC Sub Layer page 57
Collision free protocols
1. Bit Map protocols
◼ Time is divided into slots.
◼ If there are N stations, then there have to be N slots in the
contention period.
◼ Station j may announce that it has a frame to send by
inserting a 1-bit into slot j.
◼ After all N slots have passed by each station has a
complete knowledge of which stations wish to transmit.
◼ Now stations begin transmitting in numerical order
1 2
3 4 5 6
A B C* D E* F* G H*
Slot 0: C*, E*, F*, H* (all nodes under node 0 can try), conflict
slot 1: C* (all nodes under node 1 can try), C sends
slot 2: E*, F*, H*(all nodes under node 2 can try), conflict
slot 3: E*, F* (all nodes under node 5 can try), conflict
slot 4: E* (all nodes under E can try), E sends
slot 5: F* (all nodes under F can try), F sends
slot 6: H* (all nodes under node 6 can try), H sends.
❑ Speed 1Gpbs
❑ Minimum framelengthis 512 bytes
❑ Operates in full/halfduplex modes
❑ mostly fullduplex
◼ No CSMA/CD