Mac-Slides
Mac-Slides
Layer
(MAC)
Functions
MAC
Multiple Access
Channelization
Collision-free
Data Link Layer
protocols
Contention protocols (MAC)
1/39
Data Link
Layer
(MAC) Outline
Functions
MAC
Multiple Access
Channelization
Collision-free
protocols
Contention protocols
1 Functions
2 MAC
Multiple Access
Channelization
Collision-free protocols
Contention protocols
2/39
Data Link
Layer
(MAC) Functions of the DLL I
Coaxial cable
Functions
MAC
Multiple Access
Channelization Multi-point single link
Collision-free
protocols
Contention protocols
4/39
Data Link
Layer
(MAC) Functions of the DLL III
• By the moment, we will consider that the data link
Functions
MAC
layer defines only communications between nodes
Multiple Access
Channelization
at the same link.
Collision-free
protocols • The data link layer is divided in two sublayers:
Contention protocols
5/39
Data Link
Layer
(MAC) Outline
Functions
MAC
Multiple Access
Channelization
Collision-free
protocols
Contention protocols
1 Functions
2 MAC
Multiple Access
Channelization
Collision-free protocols
Contention protocols
6/39
Data Link
Layer
(MAC) Outline
Functions
MAC
Multiple Access
Channelization
Collision-free
protocols
Contention protocols
1 Functions
2 MAC
Multiple Access
Channelization
Collision-free protocols
Contention protocols
7/39
Data Link
Layer
(MAC) Channel Access I
Functions
MAC
Multiple Access
Channelization • Apart from defining the frame, a big issue that must be
Collision-free
protocols
Contention protocols
defined by the MAC is how nodes must access the
link.
• The main problem arises when there are several nodes
on the same link.
• We need to determine which node can transmit at
which time.
• This issue is known as Multiple Access (MA).
• Notice that the problem is that a collision occurs if
more than one node transmits at the same time.
8/39
Data Link
Layer
(MAC) Channel Access II
Functions
MAC
Multiple Access
Channelization
Collision-free
protocols
Contention protocols • The main techniques for multiple access (MA) can be
classified as:
• Multiple Access with channelization. FDMA, TDMA,
CDMA.
• Multiple Access without channelization. These can
be further divided in collision-free and contention
techniques.
9/39
Data Link
Layer
(MAC) Channel Access III
Functions • Collision-free algorithms. These algorithms ensure
MAC that a collision can never occur.
Multiple Access
Channelization
• Polling.
Collision-free
protocols
• Tokens (decentralized polling).
Contention protocols
• Bit-map protocol.
• Binary countdown.
• Contention algorithms. They resolve a collision after it
occurs. These algorithms execute a collision resolution
algorithm after a collision.
• Aloha.
• S-Aloha.
• Carrier Sense Multiple Access (CSMA).
• Carrier Sense Multiple Access Collision Detection
(CSMA-CD).
• Carrier Sense Multiple Access Collision Avoidance
(CSMA-CA).
10/39
Data Link
Layer
(MAC) Outline
Functions
MAC
Multiple Access
Channelization
Collision-free
protocols
Contention protocols
1 Functions
2 MAC
Multiple Access
Channelization
Collision-free protocols
Contention protocols
11/39
Data Link
Layer
(MAC) Static channelization
Functions
• Channelization is a
MAC multiple-access (MA) method.
Multiple Access
Channelization • The available capacity of the
Collision-free
protocols link is divided using a B
Contention protocols
multiplexing technique.
• Types of static channel
allocation: A Channel C->A
GSM).
13/39
Data Link
Layer
(MAC) Outline
Functions
MAC
Multiple Access
Channelization
Collision-free
protocols
Contention protocols
1 Functions
2 MAC
Multiple Access
Channelization
Collision-free protocols
Contention protocols
14/39
Data Link
Layer
(MAC) Polling
Functions
Master A B Master A B
MAC
Multiple Access
Tokens are a way of decentralized polling.
Channelization
Collision-free • These techniques avoid using a master node.
protocols
Contention protocols
• We have user data frames and also a special control
frame called token.
• When a node receives the token, it can transmit its data
frames.
• When the node with the token finishes its transmission,
it passes the token (sends the token frame) to another
node.
• There are two types of LAN that use this technique:
token ring and token bus.
16/39
Data Link
Layer
(MAC) Tokens II
Functions
MAC
Multiple Access
Channelization
Collision-free
Token
protocols
Contention protocols
• Drawbacks of Tokens
• If token disappears (the token frame is lost), nobody
can transmit.
• If there is a token duplicity, we might have collisions.
17/39
Data Link
Layer
(MAC) Outline
Functions
MAC
Multiple Access
Channelization
Collision-free
protocols
Contention protocols
1 Functions
2 MAC
Multiple Access
Channelization
Collision-free protocols
Contention protocols
18/39
Data Link
Layer
(MAC) Aloha I
Functions
• Developed by the Hawaii University in the 70’s.
MAC
Multiple Access
Channelization
Collision-free • Nodes send frames without P=Frame size
protocols
B=link bit rate
Contention protocols any previous negotiation.
Frame
• Transmissions are always
asynchronous because the t
P
frames are sent when required. T x=
B
• Obviously, we can NOT be sure that frames arrive OK
to the receiver because of collisions.
• Remember that collisions occur when two or more
senders transmit a frame at the same time.
• Aloha uses an acknowledgement (ACK) control frame
that is sent through the other way channel to indicate a
positive reception of the data frame.
19/39
Data Link
Layer
(MAC) Aloha II
• If the sender does not receive the ACK frame, it waits
Functions for a random time, called back-off time and then
MAC
Multiple Access
retransmits the frame.
Channelization
Collision-free
protocols Station A frame A1 frame A2 BO1-A2 ...
Contention protocols Time
Station B frame B1
BO1-B1
frame B1
BO2-B1 ...
Time
BO1-C1
frame C1 frame C1
Station C
Time
BO1-D1
frame D1 frame D1
BO2-D1 ...
Station D
Time
TX Collision Collision TX
A1 A2,B1,C1,D1 B1,D1 C1
21/39
Data Link
Layer
(MAC) Aloha IV
Y's end collides with Z's beginning with
Functions X's beginning X's end collides
• We use the
MAC
Begin
term
End
Multiple Access Y
Channelization
Collision-free
”vulnerable
Begin
End
protocols
Contention protocols
period“ to X
denote the
Begin
period of time
End
Assumption: ACK's Z
End
are transmitted by a
that a frame X “free of collisions”
may collide channel.
• Any frame that starts within time t from the starting point of X
(either before or after) will collide with X.
• The bigger the vulnerable period, the higher the probability
of collisions.
• The vulnerable period in Aloha is 2Tx .
22/39
Data Link
Layer
(MAC) Slotted Aloha I
Begin
collision
End
Functions Y
MAC
Multiple Access • Slotted Aloha
Channelization
Collision-free
(S-Aloha)
Begin
End
X
protocols
Contention protocols
reduces the
vulnerable
period to
Begin
End
Z
reduce the
collision
probability. t-Tx t t+Tx
Vulnerability period=Tx
23/39
Data Link
Layer
(MAC) Slotted Aloha II
Functions Slot 1 Slot 2 Slot 3 Slot 4 Slot 5 Slot 6
MAC
Multiple Access Station A frame A1 frame A2
Channelization
Collision-free
protocols
Contention protocols
Station B frame B1 frame B1
frame C1 frame C1
Station C
frame D1 frame D1
Station D
Collision Collision
B1,C1 A2,D1
24/39
Data Link
Layer
(MAC) Carrier Sense Multiple Access
Functions
MAC A B E F
Multiple Access B senses here
Channelization
E senses here
Collision-free • Carrier t1
protocols
Contention protocols sense t1+D
means: Frame
”listen
before
transmit“.
F senses
here
25/39
Data Link
Layer
(MAC) Persistence in CSMA I
Functions
• Non-persistent CSMA:
MAC
Multiple Access • Step 1: If the medium is idle, transmit immediately.
Channelization
Collision-free • Step 2: If the medium is busy, enter in back-off (wait a
protocols
Contention protocols random amount of time) and repeat Step 1.
• Notice that there is a trade-off:
• Large back-offs reduce the probability of collisions.
• Large back-offs introduce delay and might force the
stations to not to use the channel even though it is idle.
• 1-persistent CSMA:
• Step 1: If the medium is idle, transmit immediately.
• Step 2: If the medium is busy, continue listening until
the medium becomes idle, and then transmit
immediately.
• Notice that if two nodes are waiting for the channel to
become idle to transmit their respective frames, there
will be a collision.
26/39
Data Link
Layer
(MAC) Persistence in CSMA II
Functions
MAC
Multiple Access CSMA Persistence
Channelization
Collision-free Sense and Transmit Sense and Transmit
protocols
Contention protocols Continuously sense Sense Sense
wait wait
Time
1-persistent non-persistent
Probability outcome does not allow
transmission Transmit
Continuously sense
*
Time Time Time Time
slot slot slot slot
Time
Busy * Selected time slot
p-persistent
27/39
Data Link
Layer
(MAC) Persistence in CSMA III
Functions
MAC
Multiple Access
Channelization
• p-persistent CSMA:
Collision-free
protocols • Step 1: If the medium is idle, transmit with probability p,
Contention protocols
or delay the transmission with probability (1-p). The
transmission is delayed for a time-slot.
• Step 2: For a delayed frame transmission, if we find the
medium busy, we continue listening until it becomes idle
and then we go to Step 1.
• Step 3: For a delayed frame transmission, if we find the
medium idle, we go to Step 1.
• Typically, the time-slot duration is set to the worst
propagation between any two stations in the link (Dmax ).
28/39
Data Link
Layer
(MAC) Persistence in CSMA IV
Persistence Algorithms
Functions
MAC
Multiple Access
Channelization busy
Wait
Collision-free Channel? Channel?
protocols busy randomly
Contention protocols
idle idle Back-off
station can transmit station can transmit
1-persistent non-persistent
busy
Channel?
idle
Wait Probability
Channel?
a slot >p outcome?
busy <p
p-persistent
29/39
Data Link
Layer
(MAC) Persistence in CSMA V
Functions
30/39
Data Link
Layer
(MAC) CSMA-CD
Functions
MAC
Multiple Access
Channelization
• We can not further reduce the vulnerable period, so we
Collision-free
protocols need new ideas.
Contention protocols
31/39
Data Link
Layer
(MAC) Collision Detection
Functions Energy
MAC • The coaxial
Multiple Access Coaxial cable
Channelization cable allows
Collision-free
protocols us to detect
Contention protocols Collisions (more average energy)
collisions by
measuring
Frame Frame
the average transmission transmission
power. Time
Idle
MAC
Multiple Access
Channelization
A B E F
protocols
Contention protocols
t1 t2
First b
it o fA
t3
of E
t b it
Firs Collision E's collision:
occurs detection and
abortion
t4
A's collision:
detection and
abortion
time
33/39
Data Link
Layer
(MAC) Maximum Detection Time
Functions
(CSMA-CD)
MAC
t0
Multiple Access
Channelization
Collision-free
protocols
Contention protocols
t0+D-ε
t0+D+ε
t0+2D
34/39
Data Link
Layer
(MAC) Frame Collision
Functions
MAC
Multiple Access
A B E F
Channelization
Collision-free
protocols
Collision occurs
Contention protocols
t1 t2
Part of
A 's fram
e t3
e
ram
's f
fE
rt o
Pa
t4
E detects time
A detects collision
collision and
and aborts
aborts
35/39
Data Link
Layer
(MAC) CSMA-CD Jamming
Functions
MAC
Multiple Access
A B E F
Channelization
Collision-free Collision occurs
protocols t1 t2
Contention protocols
Part of
A 's fram
e t3
Jamming Collision
e
's fram detection
fE by F
rt o
Pa ce
t4 ue n
g s eq
min
Jam
time
E detects
collision,
jamming and
aborts
36/39
Data Link
Layer
(MAC) CSMA-CA I
Functions
MAC
Multiple Access
Channelization
Collision-free
protocols • There are media in which we cannot detect collisions.
Contention protocols
37/39
Data Link
Layer
(MAC) CSMA-CA II
Functions • CSMA-CA roughly works as follows:
MAC • A node wishing to transmit senses the medium.
Multiple Access
Channelization • If the medium is sensed as ”idle”, then the node is
Collision-free
protocols permitted to transmit its frame.
Contention protocols
• If the channel is sensed as ”busy“:
• The node defers its transmission entering in back-off.
• The node continuously senses the medium.
• The back-off time is only discounted when the node
senses the medium as ”idle“.
• When the back-off time is totally discounted and the
medium is idle, the node can transmit its frame.
• Any collision that occurs at that point cannot be
detected.
• To deal with undetected collisions, the receiver sends an
ACK.
• If the transmitter does not receive the ACK, assumes a
collision and retransmits the frame.
38/39
Data Link
Layer
(MAC) CSMA-CA III
Functions
TS
MAC
Multiple Access Collision
Channelization ack2
Collision-free
protocols
Contention protocols
frame 2
frame 4
frame 3
39/39