0% found this document useful (0 votes)
6 views

Unit - 3 (Data Link Layer) - Part II

COMPUTER NETWRKS

Uploaded by

Ayush Mishra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
6 views

Unit - 3 (Data Link Layer) - Part II

COMPUTER NETWRKS

Uploaded by

Ayush Mishra
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 93

Computer Networks (CSC305)

Course Outline:

√Overview of Data Communication and Networking


√Physical Layer
√Data Link Layer
- Logical Link Control (LLC)
- Medium Access Control (MAC)
- Network Layer
- Transport Layer
- Application Layer
OSI Reference Model
OSI Reference Model
Data Link Layer

Responsible for NODE-TO-NODE Communication.


The data-link layer of the source host needs only to encapsulate, the data-link layer of the destination
host needs to de-capsulate, but each intermediate node needs to both encapsulate and de-capsulate.
Data Link Layer
It has two sub-layers:
Data Link
Layer

Medium
Logical Link
Access
Control (LLC)
Control (MAC)
Data Link Layer | Medium Access Control (MAC) Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

• Addressing
 Physical Device Addressing

• Medium Access Protocols


 Collision-based Protocols
 Collision-Free Protocols

• Channelization
 TDMA
 FDMA
 CDMA

• IEEE Project 802


Data Link Layer | Medium Access Control (MAC)
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Channel Allocation
 Static Channel Allocation: Static FDM can be used. But there will be a wastage of bandwidth.

 Dynamic Channel Allocation.

Assumptions

 Station Model: In a system ‘N’ nodes are connected & all nodes are independent. All stations
generate frames at the constant rate.

 Availability of Single channel between all stations.

 Collision (when more than one frame is travelling in the medium). Collision detection is
analog-based. All stations can detect collisions.

 Time: Continuous (Transmission can begin at any instant) OR Slotted (Transmission begin at
the start of a slot).

 Carrier Sense or No sense: Channel can be idle, collision.


Data Link Layer | Medium Access Control (MAC)
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

• Addressing
 Physical Device Addressing

• Medium Access Protocols


 Collision-based Protocols
 Collision-Free Protocols

• Channelization
 TDMA
 FDMA
 CDMA

• IEEE Project 802


Medium Access Control (MAC) | Addressing
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC Address / Hardware Address / Physical Address

6 bytes address (48 bits)

Hexadecimal notation using hyphen to separate bytes.

Example: 06-01-02-01-2C-4B
Data Link Layer | Medium Access Control (MAC) Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

• Addressing
 Physical Device Addressing

• Medium Access Protocols


 Collision-based Protocols
 Collision-Free Protocols

• Channelization
 TDMA
 FDMA
 CDMA

• IEEE Project 802


Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed Passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Non-Carrier Sensed | ALOHA Protocol
This is a Random Access Protocol.

In random-access methods, no station is superior to another station and none is assigned control
over another.
 There is no scheduled time for a station to transmit.
 Transmission is random among the stations.

It was designed, at the University of Hawaii, for a wireless LAN, but it can be used on any shared
medium.

When a station sends data, another station may attempt to do so at the same time.

There are potential collisions in this management. The data from the two stations collide and
become garbled.

Pure ALOHA Slotted ALOHA


ALOHA Protocol | Pure ALOHA ALOHA

Pure Slotted
The original ALOHA protocol, which is LAN based.

BASIC IDEA: Each station sends a frame whenever it has a frame to send (multiple access).

There is the possibility of collision between frames from different stations.

• Four stations that contend with one another


for access to the shared channel.

• Each station sends two frames.

• Only two frames survive: One from station 1


and another one from station 3.

Need to resend the frames that have been


destroyed during transmission.
When a station sends a frame, it expects the
receiver to send an ACK.
ALOHA Protocol | Pure ALOHA
ALOHA

Pure Slotted

If the ACK does not arrive after a time-out period, the station assumes that the frame (or the ACK) has
been destroyed and resends the frame.

If all stations try to resend their frames after the time-


out, the frames will collide again.

Pure ALOHA dictates that when the time-out period


passes, each station waits a random amount of
time before resending its frame.

The randomness will help avoid more collisions. The


time is called back-off time TB.

After a maximum number of retransmission


attempts Kmax, a station must give up and try later –
This is another method to prevent congesting the
channel with retransmitted frames.
ALOHA Protocol | Pure ALOHA ALOHA

Pure Slotted
Vulnerable Time
The length of time in which there is a possibility of collision.
Lets assume that the stations send fixed-length frames with each frame taking Tfr seconds to send.

Station A: Starts to send a frame at time ‘t’.

Station B: Imagine it has started to send its


frame after (t - Tfr).

This leads to a collision between the frames


from station A and station B.

On the other hand, suppose that Station C


starts to send a frame before (t + Tfr).

There is also a collision between frames from


Station A and Station C.
Pure ALOHA vulnerable time = 2 x Tfr
ALOHA Protocol | Pure ALOHA ALOHA

Pure Slotted
Throughput

Let the “Frame Time (t)” denote the amount of time needed to transmit the standard, fixed-length
frame (i.e., the frame length divided by the bit rate).

Assume, ‘S’ frames are generated in time ‘t’.

(Let us assume that the infinite population of users generates new frames according to a Poisson
Distribution with mean ‘S’ frames per frame time.)

If 𝑺 > 𝟏, the user community is generating frames at a higher rate than the channel can handle:
COLLISION.

For reasonable throughput: 𝟎 < 𝑺 < 𝟏


ALOHA Protocol | Pure ALOHA ALOHA

Pure Slotted
For reasonable throughput: 𝟎 < 𝑺 < 𝟏

Let us assume that the probability of ‘k’ transmission attempts per frame time, old and new
combined, is also Poisson, with mean G per frame time. This means G ≥ S.

At LOW LOAD (i.e., S ≈ 0), there will be few collisions, hence few re-transmissions, so G ≈ S.
At HIGH LOAD, there will be many collisions, so 𝑮 > 𝑺.

Under ALL LOADS, the throughput (S) is just the offered load (G) times the probability (P0) of a
transmission succeeding (without collision), i.e.,

𝑆 = 𝐺 . 𝑃0

The probability that ‘k’ frames are generated during a given frame time is given by the Poisson
Distribution:
𝐺 𝑘 . 𝑒 −𝐺
𝑃𝑟 𝑘 =
𝑘!
So, the probability of zero frames (𝒌 = 𝟎) is just 𝐞−𝐆 .
ALOHA Protocol | Pure ALOHA ALOHA

Pure Slotted
So, the probability of no events occur in that period is just 𝑒 −𝐺 . That is

𝑃𝑟 𝑘 = 0 = 𝑒 −𝐺 (For one time period)

Vulnerability for a frame = 2t, i.e., within a period of 2t of sending a frame, no new frame should
be generated.

In an interval two frame times long, the mean number of frames generated is 2G. So, the
probability of zero frame being generated during entire vulnerable period (2t) is:

𝑃𝑟 𝑘 = 0 = 𝑒 −2𝐺

Therefore, 𝑆 = 𝐺 . 𝑃0 𝑆 = 𝐺. 𝑒 −2𝐺

The throughput (S) will be maximum, when G = 1/2, i.e.,


1 1
−2.2 1 That is 18% is the channel utilization
𝑆= .𝑒 = = 0.184 in PURE ALOHA.
2 2𝑒
ALOHA Protocol | Slotted ALOHA ALOHA

Pure Slotted
No rule is defined in pure ALOHA about when the station can send frames.

Therefore, the vulnerability time for Pure ALOHA


is 2xTfr.

Channel utilization efficiency for Pure ALOHA


is only 18.4%.

Slotted ALOHA was invented to improve the


efficiency of Pure ALOHA.

It divides the time into slots of Tfr seconds and


force the station to send only at the beginning
of the time slot.

If a station misses the moment (beginning of a particular slot), it must wait until the beginning of
the next time slot.
ALOHA

ALOHA Protocol | Slotted ALOHA Pure Slotted

There is still the possibility of collision if two stations try to send at the beginning of the same time
slot.
The vulnerable time is now reduced to one-
half, equal to Tfr.

Slotted ALOHA vulnerable time = Tfr

The probability of no other traffic during the


same slot is 𝑒 −𝐺 , which leads to

𝑆 = 𝐺. 𝑒 −𝐺

The throughput (S) will be maximum, when G


= 1, i.e.,
1
𝑆 = 1 . 𝑒 −1 = = 0.368
𝑒
That is 36% is the channel utilization in PURE ALOHA.
Non-Carrier Sensed | ALOHA Protocol
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-
Protocol free Protocol

Non-Carrier Carrier- Token Binary Count Adaptive


Bit-Map Polling
Sensed Sensed Passing Down Tree Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | CSMA Protocol Carrier-
Sensed

CSMA CSMA/CD CSMA/CA


CSMA: Carrier Sense Multiple Access

Developed to minimize the chance of collision and increase the performance.

Nodes will check/sense the carrier just before sending data.

Only if the channel is idle, node will send the data (it won’t send data in case of collision or
transmission/busy).

Complexity increases.

Collision may occur when both nodes sense that


carrier is free at the same time and sends data.

Propagation delay may also lead to collision. A


data has been sent but because of propagation
delay, node may sense that carrier is free & send
the data.
MAC Protocols | CSMA Protocol Carrier-
Sensed

CSMA CSMA/CD CSMA/CA


Vulnerable time for CSMA is the propagation time (Tp).

Time needed for a signal to propagate from one end of the medium to the other.

If the first bit of the frame reaches the end of the medium, every station will already have heard the bit
and will refrain from sending.
MAC Protocols | CSMA Protocol Carrier-
Sensed

CSMA CSMA/CD CSMA/CA

What should a station do if the CHANNEL is BUSY?

What should a station do if the CHANNEL is IDLE?

Persistence Methods

CSMA

1- Non- P-
Persistent Persistent Persistent
CSMA Protocol | 1-Persistent CSMA

1- Non- P-
Persistent Persistent Persistent
1-Persistent
Simple and straightforward.

After the station finds the line idle, it sends its frame immediately (with probability 1).

Otherwise, the station continuously sense the channel for its availability.

Highest chance of collision because two or more stations may find the line idle and send their frames
immediately.
CSMA Protocol | Non-Persistent CSMA

1- Non- P-
Non-Persistent Persistent Persistent Persistent

A station that has a frame to send senses the line.


 If idle, sends its frame immediately.
 If busy, it waits a random amount of time and then senses the line again.

It reduces the chance of collision because it is unlikely that two or more stations will wait the same
amount of time and retry to send simultaneously.

It reduces the efficiency of the network because the medium remains idle when there may be
stations with frames to send.
CSMA Protocol | P-Persistent CSMA

1- Non- P-

P-Persistent Persistent Persistent Persistent

Used in the slotted channel with a slot duration equal to or greater than the maximum propagation
time.
• Combines the advantages of 1-persistent (continuously sense) and non-persistent (transmit
with ‘p’ probability i.e., between 0 and 1).
• Reduces the chance of collision and improves efficiency.
After the station finds the line idle, it follows these steps:

1. With probability ‘P’, the station sends its frame.

2. With probability ‘q = 1 - p’, the station waits for the beginning of the next time slot and
checks the line again:

 If the line is idle, it goes to step 1.

 If the line is busy, it acts as though a collision has occurred and uses the back-off
procedure.
CSMA Protocol | P-Persistent CSMA

1- Non- P-
If P = 0.4, the node will generate a random number (R) between 0 to 1. Persistent Persistent Persistent

 If R ≤ 0.4, the node will transmit frame.


 If R > 0.4, the node will not transmit
frame and will wait for next slot to
repeat.

P Collision
CSMA Protocol
Comparison of the Channel Utilization versus Load for various Random Access Protocols
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed Passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Carrier-

MAC Protocols | CSMA/CD Protocol Sensed

CSMA CSMA/CD CSMA/CA


CSMA/CD: Carrier Sense Multiple Access with Collision Detection

Persistent and non-persistent CSMA protocols are clearly an improvement over ALOHA because
they ensure that no station begins to transmit when it senses the channel busy.

CSMA/CD augments the algorithm to handle the collision. It allows station to aborts the
transmissions as soon as they detect a collision.

If two stations sense the channel to be idle and begin transmitting simultaneously, they will both detect
the collision almost immediately and stops transmitting.

Quickly terminating damaged frames saves time and bandwidth.

Collision can be detected by looking at the power or pulse width of the received signal and
comparing it to the transmitting signal.
MAC Protocols | CSMA/CD Protocol Carrier-
Sensed

CSMA CSMA/CD CSMA/CA

After a station detects a collision, it aborts its transmission, waits a random period of time, and then
tries again, assuming that no other station has started transmitting in the meantime.

Before sending the last bit of the frame, the sending station must detect a collision, if any, and
abort the transmission. This is so because the station, once the entire frame is sent, does not keep a
copy of the frame and does not monitor the line for collision detection.
MAC Protocols | CSMA/CD Protocol Carrier-
Sensed

Suppose that two stations both begins transmitting at exactly time t0. CSMA CSMA/CD CSMA/CA

How long will it take them to realize that there has been a collision?
 The minimum time to detect the collisions is then just the time it takes the signal to
propagate from one station to the other.

A station not hearing a collision for a time equal to the full cable propagation time after starting its
transmission could be sure it had seized the cable. By “seized”, it means that all other stations knew it
was transmitting and would not interfere. - WRONG
MAC Protocols | CSMA/CD Protocol Carrier-
Sensed

CSMA CSMA/CD CSMA/CA


Consider the following Worst-Case Scenario:
Let the time for a signal to propagate between the two farthest stations be 𝝉.
At t0, one station begins transmitting.

At 𝝉 − 𝜺, an instant before the signal arrives at the most distant station, that station also begins
transmitting.
• It detects the collision almost instantly and STOPS, but the little noise burst caused by
the collision does not get back to the original station until time 2𝜏 − 𝜀.
• In other words, in the worst-case a station cannot be sure that it has seized the channel until
it has transmitted for 2𝜏 without hearing a collision.
For this reason, it is required to model the contention interval as a Slotted ALOHA system with
slot width 𝟐𝝉.

The frame transmission time Tfr must be at least two times the maximum
propagation time 𝝉.

CSMA/CD imposes a restriction on the frame size (𝑳 ≥ 𝟐. 𝝉. 𝑩𝑾).


MAC Protocols | CSMA/CD Protocol 1-persistent method: Max
throughput is around 50% when G
= 1.

Non-persistent method: Max


throughput can go up to 90%
when G is between 3 and 8.

Can be replaced by one of the


persistence processes.

Transmission and Collision


Detection are continuous
processes.

To make sure that all other


stations become aware of the
collision.

𝟏 𝒕𝒑𝒓𝒐𝒑
𝑼= ,where a =
𝟏+𝟔.𝟒𝟒𝒂 𝒕𝒕𝒓𝒂𝒏𝒔
MAC Protocols | CSMA/CD Protocol
How randomization is done when a collision occurs?

Binary Exponential Back-off Algorithm

After a collision, the time is divided into discrete slots whose length is equal to the worst-case
round trip propagation time on the ether (2𝜏).

To accommodate the longest path allowed by Ethernet, the slot time has been set to 512 bit times or
51.2 𝜇sec.

After ‘c’ collision, a random number of slot times between 0 to 𝟐𝒄 − 𝟏 is chosen.

For the 1st collision (c = 1), each sender will wait 0 or 1 slot times.
For the 2nd collision (c = 2), each sender will wait anywhere from 0 or 3 slot times.
For the 3rd collision (c = 3), each sender will wait anywhere from 0 or 7 slot times.

As the number of retransmission attempts increases, the number of possibilities for delay increases
exponentially.
MAC Protocols | CSMA/CD Protocol
After certain number of increases, the exponentiation stops, i.e., the retransmission timeout
reaches a ceiling, and thereafter does not increase any further.

After 16 attempts at transmission, the process is aborted.

If the randomization interval for all collision was 1023, the chance of two stations colliding for a second
time would be negligible, but the average wait after a collision would be hundreds of slot times,
introducing significant delay.
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed Passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Carrier-

MAC Protocols | CSMA/CA Protocol CSMA


Sensed

CSMA/CD CSMA/CA

CSMA/CA: Carrier Sense Multiple Access with Collision Avoidance

Invented for wireless networks (mostly in WLAN).

Collisions are avoided through the use of CSMA/CA’s three strategies:

 The Inter-frame Space


• Collisions are avoided by deferring transmission even if the channel is found idle.

• Idle Channel: Station waits for a period of time called the Inter-frame Space or IFS.

• The IFS time allows the front of the transmitted signal by the distant station to reach the
station (which is sensing channel).

 The Contention Window

• The contention window is an amount of time divided into slots.


• A station that is ready to send chooses a random number of slots as its wait time.
Carrier-

MAC Protocols | CSMA/CA Protocol CSMA


Sensed

CSMA/CD CSMA/CA

 The Contention Window

• The number of slots in the window changes according to the binary exponential back-off
strategy.
• The station needs to sense the channel after each time slot.

• If the station finds the channel busy, it does not restart the process; it just stops the timer and
restarts it when the channel is sensed as idle. This gives priority to the station with the
longest waiting time.

 Acknowledgement
• The positive ACK and time-out timer can help guarantee that the receiver has received the
frame.
MAC Protocols | CSMA/CA Protocol Carrier-
Sensed

CSMA CSMA/CD CSMA/CA


MAC Protocols | CSMA/CA Protocol
Carrier-
Sensed

CSMA CSMA/CD CSMA/CA

DIFS: DCF (Distributed Coordination Function)


Interframe Space
[Using DCF technique, a station needs to sense the status
of the wireless channel before it can place its request to
transmit a frame.]

SIFS: Short Interframe Space


[Short Interframe Space (SIFS), is the amount of time
in microseconds required for a wireless interface to
process a received frame and to respond with a response
frame.]

RTS: Request To Send


[When a station sends an RTS frame, it includes the
duration of time that it needs to occupy the channel.]

CTS: Clear To Send


NAV: Network Allocation Vector
[The stations that are affected by this transmission create a timer called NAV that shows how much time must pass before.]
Carrier-

MAC Protocols | CSMA/CA Protocol CSMA


Sensed

CSMA/CD CSMA/CA

What happens if there is a collision during the time when RTS or CTS control frames are in transition, often
called the handshaking period?

 Two or more stations may try to send RTS frames at the same time.

 These control frames may collide.

 There is no mechanism for collision detection. So, the sender assumes there has been a collision if it has
not received a CTS frame from the receiver.

 The back-off strategy is employed and the sender tries again.


Carrier-

MAC Protocols | CSMA/CA Protocol CSMA


Sensed

CSMA/CD CSMA/CA

Hidden Node Problem

 Station ‘A’ is sending a message to ‘B’.


 Station ‘C’ is out of its range and hence while ‘listening’ on the network it will find the network to be free
and might try to send packet to ‘B’ at the same time as ‘A’.
 Collision at Station ‘B’.
Reason: Station ‘A’ & ‘C’ are hidden from each other.
Carrier-

MAC Protocols | CSMA/CA Protocol CSMA


Sensed

CSMA/CD CSMA/CA

Addressing Hidden Node Problem


Suppose station ‘A’ wants to send a packet to
station ‘B’.
 Station ‘A’ will send a small packet to ‘B’ called
RTS.
 In response to RTS, Station ‘B’ sends a small
packet to ‘A’ called CTS.
 After ‘A’ receives a CTS, it transmits the actual
data to Station ‘B’.
 Any nodes which can hear either RTS or CTS assume the network to be busy.
 Even if some other node (say ‘C’) which is out of the range of both ‘A’ and ‘B’, sends an RTS to ‘B’, ‘B’ would
not send a CTS to ‘C’ and hence the communication would not be established between ‘B’ and other
node.
How long the rest of the nodes should wait?
What a node should do if it hears RTS but not a corresponding CTS?
Carrier-

MAC Protocols | CSMA/CA Protocol CSMA


Sensed

CSMA/CD CSMA/CA

Exposed Node Problem

 If a station ‘C’ is transmitting message to station ‘D’.


 Station ‘B’ wants to transmit a message to ‘A’, ‘B’ will find the network to be busy as ‘B’ hears ‘C’
transmitting.

 Even if station ‘B’ would have transmitting to station ‘A’, it would not have been a problem at ‘A’ or ‘D’.

CSMA/CA would not allow it to transmit a message to ‘A’, while the two transmission could have gone in
parallel.
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed Passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Bit-Map Protocol
Collision-free protocol. Also known as Reservation Protocol.

Each contention period consists of exactly N slots (as many number of stations).
If station ‘0’ has a frame to send, it transmit a 1-bit during the 0th slot. No other station is allowed to
transmit during this slot.

Station ‘j’ may announce that it has a frame to send by inserting a 1-bit in to slot ‘j’.

After all ‘N’ slots have passed by, each station has complete knowledge of which stations wish to
transmit.

At that point, they begins transmitting in numerical order.


MAC Protocols | Bit-Map Protocol
If a station becomes ready just after its bit slot has passed by, it must remain silent until every
station has had a chance and the bit map has come around again.

Desired to transmit is broadcast before the actual transmission are called RESERVATION Protocol.

The overhead per frame is ‘N’ bits, and the amount of data is ‘d’ bits i.e., to transmit ‘d’ bits, (d+N)
bits are required of which ‘N’ bits are required for collision resolution.

d
Efficiency = (Low Load)
d+N

At high load, when all the stations have something to send all the time, the ‘N’ bits contention period
is prorated over ‘N’ frame, yielding an overhead of only 1-bit per frame.
d
Efficiency = (High Load)
d+1
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed Passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Polling
Polling works with topologies in which one device is designated as a Primary station and the other
devices are Secondary stations.

All data exchanges must be made through the primary device even when the ultimate destination is a
secondary.

Used whenever the primary device Used by the primary device to solicit
has something to send. transmission from the secondary
device.
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed Passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Token Passing
Stations will be organized in a LOGICAL 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 assed to the successor when the current station has no more data to send.

Details will be covered under IEEE 802.5 project.


Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed Passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Binary Countdown Protocol
Collision-free protocol.

Problem with Bit Map Protocol: Overhead is 1 bit per station. So, it does not scale well to
networks with thousand’s of station.

Bidding Cycle: The station wanting to use the channel now broadcasts its address as a binary
bit string, starting with the high-order bit.

All addresses are assumed to be the same length.

The bits in each address position from different stations are BOOLEAN ORed together.

To avoid conflicts, an arbitration rule must be applied: As soon as a station sees that a high-order
bit position is 0 in its address has been overwritten with a 1, it gives up.

If stations 0010, 0100, 1001 and 1010 are all trying to get the channel.
MAC Protocols | Binary Countdown Protocol
Higher numbered stations have a
higher priority than lower-
numbered stations.

d
Channel Efficiency =
d + 𝑙𝑜𝑔2 N

WINNER STATION
(Highest Address)

See the 1 and The station no 4 may now transmit


See the 1 and know
know that a higher- a frame, after which another
that a higher-
numbered station is numbered station bidding cycle starts.
competing for the is competing for
channel. So, they give the channel. So,
up. they give up.
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed Passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
MAC Protocols | Adaptive Tree Walk Protocol
All stations are at the leaves of a binary tree.

First Contention Slot (Slot 0):

• All stations are permitted to try to acquire


the channel:
 If one of them does this - FINE
 If there is a collision, then
Second Contention Slot (Slot 1):
• Only stations falling under node 2 in
the tree may compete.
 If one of them acquires the channel,
the slot following the frame is reserved
for those stations under node 3.
 If two or more stations under node 2 want to transmit, there will be a collision during slot 1, in which
case it is node 4’s turn during Slot 2.
MAC Protocols | Adaptive Tree Walk Protocol
If a collision occurs during Slot 0, the entire tree is searched, depth first, to locate all ready stations.

Slot 0: C, E, F, H (all nodes under node 1 can try) - CONFLICT


Slot 1: C (Only 1 node Try) – C Sends
Slot 2: E, F, H (all nodes under node 3 can try) - CONFLICT
Slot 3: E, F (all nodes under node 6 can try) - CONFLICT

Slot 4: E (Only 1 node Try) – E Sends

Slot 5: F (Only 1 node Try) – F Sends


Slot 6: H (Only 1 node Try) – H Sends

The number of stations permitted to transmit can be dynamically adjusted, depending upon traffic.

If high load – Start search at higher level.


If low load – Start search at lower level.
MAC Protocols
HYBRID
If traffic is LOW: Collision-based is better (Low Delay)
If traffic is HIGH: Collision-free is better (Good Efficiency)

But the nature of traffic (whether high or low) is not know beforehand. So, a hybrid mechanism is
more useful that switches automatically to collision-based when the traffic is low & other way.
Medium Access Control (MAC) | MAC Protocols
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

MAC
Protocols

Collision-based Collision-free
Protocol Protocol

Non-Carrier Carrier- Token Binary Count Adaptive Tree


Bit-Map Polling
Sensed Sensed Passing Down Walk

ALOHA CSMA CSMA/CD CSMA/CA

Slotted Non-
Pure-ALOHA 1-Persistent P-persistent
ALOHA persistent
Data Link Layer | Medium Access Control (MAC) Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

• Addressing
 Physical Device Addressing

• Medium Access Protocols


 Collision-based Protocols
 Collision-Free Protocols

• Channelization
 TDMA
 FDMA
 CDMA

• IEEE Project 802


Medium Access Control (MAC) | Channelization
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Channelization is also called Channel partition.

This is a multiple-access method in which the available bandwidth of a link is shared in time,
frequency, or through code, among different stations.

Time Division Multiple Access (TDMA) – the bandwidth is just one channel that is timeshared
between different stations.
Discussed in Physical layer (under Multiplexing Topic)

Frequency Division Multiple Access (FDMA) – the available bandwidth of the common channel is
divided into bands that are separated by guard bands.
Discussed in Physical layer (under Multiplexing Topic)

Code Division Multiple Access (CDMA) – one channel carries all transmission simultaneously.
Discussed in Physical layer (under Spread Spectrum Topic)
Data Link Layer | Medium Access Control (MAC) Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

• Addressing
 Physical Device Addressing

• Medium Access Protocols


 Collision-based Protocols
 Collision-Free Protocols

• Channelization
 TDMA
 FDMA
 CDMA

• IEEE Project 802


Medium Access Control (MAC) | IEEE Project 802
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

In 1985, the Computer Society of the IEEE started a project, called Project 802, to set standards to
enable intercommunication between equipment from a variety of manufacturers.

IEEE has standardized a number of LANs and MANs under the name of IEEE 802.
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Project
802

IEEE IEEE IEEE


802.3 802.4 802.5
Ethernet MAC Token Bus Token Ring
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Project
802

IEEE IEEE IEEE


802.3 802.4 802.5
Ethernet MAC Token Bus Token Ring
IEEE Project 802 | 802.3
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

This is also called Ethernet.

IEEE 802.3 defines cabling into two categories: Only one specification for
Baseband (Digital) the Broadband Category:
Broadband (Analog) 10Broad36

IEEE divides the baseband category into five different standards:


Standard Medium Data Rate Maximum Cable Length Nodes per Segment Connector
or Type of Cable
10Base5 Thick Coaxial 10Mbps 500m 100 nodes/segment Vampire Tap
Cable
10Base2 Thin Coaxial 10Mbps 185m 30 nodes/segment Bayonet Network
Cable Connector (BNC)
10BaseT UTP 10Mbps 100m 1024 nodes/segment RJ-45
10BaseF Fibre Optics 10Mbps 2000m 1024 nodes/segment

10Base2: THIN ETHERNET, 10Base5: THICK ETHERNET, 100BASEFx: FAST ETHERNET,


10GBaseT: GIGABIT ETHERNET
IEEE Project 802 | 802.3
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Access Method : CSMA/CD (1 persistent)

Signalling : Baseband System – Manchester Digital Encoding


Broadband System – Differential PSK
Data Rate : Ethernet LANs can support data rates between 1 and 100Mbps.

Addressing : Six-byte physical address.

Frame Format :

Bytes 7 1 6 6 2 0-1500 0-46 4


Preamble SFD Destination Source Type Data Pad Checksum
Address Address

Preamble: 56 bits of alternating 0s and 1s. Alert receiver to synchronize its input timing. Added at the
physical layer (not a part of the frame).

SFD (Start of Frame Delimiter): Signal the beginning of the frame (10101011). Warns the station
that this is the last chance for synchronization. This is also added at the physical layer.
IEEE Project 802 | 802.3
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Frame Format :
Bytes 7 1 6 6 2 0-1500 0-46 4
Destination Source
Preamble SFD Type Data Pad Checksum
Address Address

Destination Address: Physical address of the packet’s next destination (6 bytes).


The high-order bit (47th) is 0 for ordinary addresses and 1 for group addresses.

Source Address: Physical address of the last device (6 bytes).

Type: Defines the upper-layer protocol whose packet (IP, ARP, OSPF etc.) is encapsulated in the
frame.
Pad: To distinguish a valid frames from garbage, 802.3 states that valid frames must be at least 64
bytes long (from destination address to CRC).
If the data portion of a frame is less than 46 bytes, the pad filed is used to fill out
the frame to the minimum size.
CRC: Contains the error detection information, in this case a CRC-32. [Trailer Part of a frame.]
IEEE Project 802 | 802.3
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

10Mbps LAN with maximum length 2500m and 4 repeaters. Thick Ethernet is used (10Base5).
500 500 500 500 500

Signal speed in the cable is 105 km/sec = 108 m/sec.

2500 . 2
Time Taken (RTT) = = 50 𝜇𝑠𝑒𝑐
108

Data rate is 10 Mbps. So, in 50 𝜇𝑠𝑒𝑐, the smallest frame that is guaranteed to work will be 500 bits.

To add some margin of safety, the number is rounded up to 512 bits or 64 bytes.

For 2500 m LAN operation at 1 Gbps, the minimum frame size would to be 6400 bytes.

Network Speed Minimum Frame Length Maximum Cable Length


IEEE Project 802 | 802.3
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Transmission of Address Bits

The way the addresses are sent out online is different from the way they are written in hexadecimal
notation.
The transmission is left to right, byte by byte; however, for each byte, the least significant bit is sent
first and the most significant bit is sent last.

This means that the bit that defines as address as Unicast or Multicast arrives first at the receiver.
47:20:1B:2E:08:EE

Hexadecimal 47 20 1B 2E 08 EE
Binary 01000111 00100000 00011011 00101110 00001000 11101110
Transmitted 11100010 00000100 11011000 01110100 00010000 01110111

0: Unicast
1: Multicast
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Project
802

IEEE IEEE IEEE


802.3 802.4 802.5
Ethernet MAC Token Bus Token Ring
IEEE Project 802 | 802.4
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Physically, the token bus is a linear or tree-shaped cable onto which the stations are attached.

Logically, the stations are organized in to a ring, with each station knowing the address of the station to
its left (predecessor) and right (successor).

When the logical ring is initialized, the highest


numbered station may send the first frame.

After it is done, it passes permission to its immediate


neighbour by sending the neighbour a special control
frame called a TOKEN.

The token propagates around the logical ring, with only


the token holder being permitted to transmit frames
for a certain amount of time.

Since only one station at a time holds the token, collision do not occur.

MAC protocol has a provision for adding and deleting stations to and from the ring.
IEEE Project 802 | 802.4
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Access Method : Token Passing


Signalling : FSK
Multilevel Duo-binary Amplitude Modulated PSK

Data Rate : 1, 5 and 10Mbps.

Addressing : Six-byte physical address.

The token bus defines four priority classes (0, 2, 4, 6) for traffic with 0 - the lowest and 6 - the
highest.

As input comes in to the MAC sub-layer, the data are checked for priority and routed to one of the
four sub-stations (as per the defined priority classes). Each sub-stations maintains its own queue of
frames to be transmitted.

Token Movement: Priority 6 Sub-station to Priority 4 Sub-station to Priority 2 Sub-station to Priority 0


Sub-station.
IEEE Project 802 | 802.4
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Frame Format :
2 2 0-8182
Bytes 1 1 1 4 1
6 6 0-8174
Frame Destination Source End
Preamble SFD Data Checksum
Control Address Address Delimiter

Frame Control: Used to distinguish Data frames from Control frames.

• For data frames, it carries the frame’s priority. It can also carry an indicator requiring the
destination station to ACK correct or incorrect receipt of the frame [Without this indicator,
the destination would not be allowed to send anything because it does not have the
token].

• For control frames, this field is used to specify the frame type. The allowed type include
token passing and various ring maintenance frames, including, the mechanism for
letting new station enter the ring, allowing stations to leave the ring and so on.
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Project
802

IEEE IEEE IEEE


802.3 802.4 802.5
Ethernet MAC Token Bus Token Ring
IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Token ring resolves the collision issue by requiring that stations take turns sending data.

Each station may transmit only during its turn and may send Only One Frame During Each
Turn.
The mechanism that coordinate this rotation is called Token Passing. A token is a simple
placeholder frame that is passed from station to station around the ring.

Whenever the network is unoccupied, it circulates a simple three-byte token. This token is
passed from NIC to NIC in sequence until it encounters a station with data to send. That station
waits for the token to enter its network board.
IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

The data frame proceeds around the ring, being regenerated by each station.

Each intermediate station examines the destination address, finds that the frame is addressed to
another station, and relays it to it neighbour.

The intended recipient recognizes is own address, copies the message,


checks for errors, and changes four bits in the last byte of the frame to
indicate address recognized and frame copied.

The full packet then continues around the ring until it returns to the station
that start it.

The sender receives the frame and recognizes itself in the source address field.

It then examines the address-recognized bits.

If they are set, it knows the frame was received. The sender then discards the used data frame and
releases the token back to the ring.
IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Access Method : Token Passing


Signalling : Differential Manchester Encoding
Data Rate : Supports data rates of up to 16 Mbps
Addressing : Six-byte physical address.
Frame Format :

Token
IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Start Delimiter (SD): Is used to alert the receiving station to the arrival of a frame as well as to allow it
to synchronize its retrieval timing.

Access Control (EC): It includes four subfields:

Token Monitor
Priority Reservation
Bit Bit
3 1 1 3

The token bit is set to indicate that the frame is a data/command frame rather than a token frame.

Reservation bit can be set by stations wishing to reserve access to the ring.
IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Frame Control (FC): It includes two sub fields:

Type Special Information

1 7

Type bit indicates whether it is control information or data.

Rest of the bit contains information used by the token ring logic.

End Delimiter (ED): It indicates the end of the sender’s data and control information.
IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Frame Status (FS):

 It can be set by the receiver to indicate that the frame has been read, or by the monitor to
indicate that the frame has already been around the ring.

 It does tell the sender that the receiving station has copied the frame, which can now be
discarded.

It contains two one-bit pieces of information: Address Recognized (AR) and Frame Copied (FC).

AR FC AR FC

• The repetition is for the purpose of preventing errors (not covered in CRC) and is necessary
because the field contains information inserted after the frame leaves the sending station.
IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

AR FC AR FC

• When a frame arrives at the interface of a station with the destination address, the interface
turns on the AR bit as it passes through.

• If the interface copies the frame to the station, it also turns on the FC bit.

 When the sending station drains the frame from the ring, it examines the AR and FC bits:

• AR = 0 and FC = 0: Destination not present or not powered up.


• AR = 1 and FC = 0: Destination present but frame not accepted.
• AR = 1 and FC = 1: Destination present or frame accepted.

This arrangement provides an automatic ACK for each frame.


IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Ring Maintenance:

Each token ring has a monitor station that oversees the ring.

If monitor goes down, a contention protocol ensures that another station is quickly elected as
monitor.
Monitor’s responsibilities:

• Ensures the presence of token in a ring.


 The monitor has a timer that is set to the longest possible token-less interval: each
station transmitting for the full token-holding time.
 If this timer goes off, the monitor drains the ring and issues a new token.

• Cleaning the ring up when garbled frames appear.


 The monitor can detect the garbled frame by its invalid format or CRC.

 It opens the ring to drain and issue new token once the ring is cleaned-up.
IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

• Watching out for an orphan frames.

 The monitor detects orphan frames by setting the monitor bit in the Access Control byte
whenever it passes through.

Token Monitor
Priority Reservation
Bit Bit
3 1 1 3

 If an incoming frame has this bit set, something is wrong since the same frame has
passed the monitor twice without having been drained, so the monitor drains it.

• Initiate action of ring breaks.

 If the cable breaks somewhere, the ring dies.

 This problem can be solved very elegantly by the use of a wire center.
IEEE Project 802 | 802.5
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

 Physically each station is connected to the wire centre by a cable containing two twisted
pairs, one for data to the station and one for data from the station.
 Inside the wire centre are bypass relays that are energized by current from the stations.
 If ring breaks or station goes down, loss of the drive current will release the relay and
bypass the station.
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Project
802

IEEE IEEE IEEE


802.3 802.4 802.5
Ethernet MAC Token Bus Token Ring
Medium Access Control (MAC) | IEEE Project 802
Data Link Layer

Logical Link Medium Access


Control (LLC) Control (MAC)

Other Most commonly known IEEE 802 Standards:

IEEE 802.6: Metropolitan Area Network (MAN)

IEEE 802.11: Wireless LAN (Wi-Fi)


IEEE 802.11ax: High-Efficiency Wireless (Wi-Fi 6)
IEEE 802.11ay: Next-Generation Very High Throughput (VHT) Wireless
IEEE 802.11ad: Wireless Gigabit (WiGig)
Many more…

IEEE 802.15: Wireless Personal Area Network (WPAN)


IEEE 802.15.1: Bluetooth Basic Rate/Enhanced Data Rate
IEEE 802.15.4: Zigbee
IEEE 802.15.6: Body Area Networks
Many more…
IEEE 802.16: Broadband Wireless Access (WiMAX)

You might also like