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

Mac-Slides

The document discusses the Data Link Layer (DLL) and its functions, particularly focusing on Media Access Control (MAC) protocols. It covers multiple access techniques, including channelization methods like FDMA, TDMA, and CDMA, as well as collision-free and contention protocols. The document also highlights the importance of managing access to the communication link to prevent collisions among nodes.
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)
22 views39 pages

Mac-Slides

The document discusses the Data Link Layer (DLL) and its functions, particularly focusing on Media Access Control (MAC) protocols. It covers multiple access techniques, including channelization methods like FDMA, TDMA, and CDMA, as well as collision-free and contention protocols. The document also highlights the importance of managing access to the communication link to prevent collisions among nodes.
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

Data Link

Layer
(MAC)

Functions

MAC
Multiple Access
Channelization
Collision-free
Data Link Layer
protocols
Contention protocols (MAC)

Jose L. Muñoz, Juanjo Alins, Oscar Esparza, Jorge Mata


Telematics Engineering
Universitat Politècnica de Catalunya (UPC)

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

• The Data Link Layer is the protocol layer which


transfers data between adjacent network nodes!!!.
• Two nodes are adjacent if they are connected by a
single link.
• By a single link, we consider only a physical medium
and its associated physical repeaters (which do not
interpret the meaning of the bits but they only amplify
the signal).
3/39
Data Link
Layer
(MAC) Functions of the DLL II
Functions • Exception: some ”data link” technologies also consider
MAC that the data link layer can to deal with multi-link
Multiple Access
Channelization communications between nodes on the same local
Collision-free
protocols
Contention protocols
area network (LAN).
Switched LAN
• The most extended example of
A B
this is “switched Ethernet”
L2 (studied in more detail later).
L1
• In switched Ethernet there are
L3 L4 nodes called “switches“ that
implement functionalities beyond
the physical signal.
L5 L6
• Switches interpret the header of
C D the frame to switch the data to
Multi-link and multi-point the appropriate link to
destination.

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

Logical Link Control


Media Access Control (MAC) (LLC)
• Lowest sublayer (mandatory). • Uppermost sublayer (optional).
• Defines the frame format: delimiting • LLC provides frame
frames, addressing, defining fields multiplexing, flow control and
(e.g. typically frames have a field that error control.
shows which is the type of
upper-layer PDU, etc. ).
• LLC is used in some
applications in a data link, but it
• Channel Access. is not used if the frame contains
• We need to know how to send TCP/IP.
the frame. • This is because TCP/IP
• Shared channels need provides similar end-to-end
multiple access techniques. functionalities to those that LLC
provides for the data link.

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

• Frequency Division Multiple


Access (FDMA) Channel A->C
• Time Division Multiple C
Access (TDMA)
• Code Division Multiple
Access (CDMA)
• Drawbacks: we need ”a priori“ knowledge of the
number of nodes at the link and we might have
misused link capacity.
12/39
Data Link
Layer
(MAC) Dynamic channelization
Functions • Dynamic channel allocation is needed when nodes are
MAC
Multiple Access
dynamic in the link.
Channelization
Collision-free
• Example: GSM mobile networks.
protocols
Contention protocols • During a call, users use a pair of user channels: an
upload user channel and a download user channel.

• We need control channels to


assign the data channels.
• We have several users using the
control channel simultaneously.
• Typically, for the MA to the Uplink
Downlink
channel
channel
control channel, we use some
MA technique without Common
Control
channelization (S-Aloha in Channel

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

MAC • There is a central node called ”master“ who


Multiple Access Master
Channelization
manages the communications.
Collision-free
protocols
Contention protocols

Master A B Master A B

Slave to Master Master to Slave

• The master node periodically asks (polls) its slaves.


• We can easily implement Quality of Service (QoS).
• For example, poll some slaves more frequently than others.
• Drawbacks:
• One node is special (the master) and communications must always
go through the master (possible bottleneck).
• The master has to know ”a priori“ the slaves present at the link.
15/39
Data Link
Layer
(MAC) Tokens I
Functions

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

Token Bus Bus topology, circular


Standard IEEE 802.4 logic path
GM

• 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

• We assume that the propagation delay D ≈ 0 is


irrelevant and that ACKs are transmitted over a
collision-free channel (the other way channel is not
showed in the picture).
20/39
Data Link
Layer
(MAC) Aloha III
Functions Aloha Algorithm
MAC K: current number of attemps
Multiple Access Kmax:max number of attemps Station has a
Channelization
D: maximum propagation time frame to send Start
Collision-free
protocols R: random integer
Contention protocols Tx: frame transmission time
TBO: back-off time K=0

Wait TBO time


Send the frame
TBO =(R·Tx)

Choose a random integer Wait ACK timeout


R between 0 and 2k-1 >2·D + Tx
No
Typically K>Kmax? K=K+1 ACK received?
Kmax=15 No
Yes Yes
Abort Success

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.

with other t-Tx t t+Tx time


frames. Vulnerable period 2Tx

• 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

• S-Aloha introduces discrete time-slots of duration Tx .


• A station can send only at the beginning of a time-slot.
• In Aloha system, the vulnerable period has length 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

• The main problem in S-Aloha is how to synchronize the


stations to correctly use the time-slots.

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

• With CSMA, we can reduce the vulnerable period to the


propagation delay (D).
• Transmission can be done with several degrees of
”persistence“.

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

Busy Busy 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

station can transmit

p-persistent

29/39
Data Link
Layer
(MAC) Persistence in CSMA V
Functions

MAC • p-persistent let us adjust the trade-off between delay


Multiple Access
Channelization and collision probability.
Collision-free
protocols
Contention protocols • The higher the p, the lower the delay but the higher the
collision probability and on the contrary for low p.
• More specifically:
• Assume that N nodes are constantly ready to send a
frame.
• Then, Np is the expected number of nodes that will
attempt to transmit on the time-slot after the medium
becomes idle.
• If Np > 1, then a collision is expected to occur.
• Therefore, we should design our CSMA with Np < 1.

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

• Some shared media allow us to detect collisions.


• Using this idea, we can reduce the collision time by
stop transmitting when a collision is detected.
• This is called CSMA with Collision Detection or
CSMA-CD.
• Typically, CSMA-CD is used with persistence p = 1.
• This is the type of access control implemented by
Ethernet (IEEE 802.3).

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

• When there are collisions, this is energy is higher than


in a normal transmission of a frame.
• Other media like the twister pair allow us detecting
collisions by sensing the signal at the transmission and
reception pins. There is a collision if there is signal
simultaneously on both pins.
32/39
Data Link
Layer
(MAC) Collision of the first Bit
Functions

MAC
Multiple Access
Channelization
A B E F

E is transmitting without detecting collision


Collision-free
A is transmitting without detecting collision

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

• An example is the the radio frequency spectrum.


• In this case, we need to implement some mechanism to
avoid collisions (CA=Collision Avoidance).
• The idea of CSMA-CA is similar to p-persistent CSMA
but implemented in another way.
• This is the type of access control implemented by
Wireless LAN (IEEE 802.11).

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

A wants to TX C wants to TX B wants to TX


BOA=2TS BOC=3TS BOB=1TS

39/39

You might also like