logoCndocs
Osi model/Data Link Layer

Medium Access Control (MAC)

Medium Access Control (MAC) is a sublayer of the Data Link Layer in the OSI model. It is responsible for controlling how devices in a network gain access to a medium and permission to transmit data. MAC protocols are particularly important in networks where multiple devices share the same communication channel, such as in wireless networks and Ethernet LANs.

The Need for Medium Access Control

When multiple devices share the same communication medium, there needs to be a mechanism to coordinate their transmissions. Without such coordination, multiple devices might transmit simultaneously, leading to collisions and data corruption. Medium Access Control protocols provide this coordination, ensuring that devices can share the medium efficiently and fairly.

Medium Access Control

Types of Medium Access Control Protocols

Medium Access Control protocols can be broadly classified into three categories:

1. Random Access Protocols

In random access protocols, devices can transmit data whenever they have data to send, without a predetermined schedule. If a collision occurs, the devices involved in the collision follow a specific procedure to resolve the conflict and retransmit their data.

Examples of random access protocols include:

  • ALOHA: Devices transmit whenever they have data to send, without checking if the medium is free.

    • Pure ALOHA: Devices transmit at any time.
    • Slotted ALOHA: Time is divided into discrete slots, and devices can only transmit at the beginning of a slot.
  • Carrier Sense Multiple Access (CSMA): Devices listen to the medium before transmitting.

    • CSMA with Collision Detection (CSMA/CD): Devices detect collisions during transmission and stop transmitting immediately.
    • CSMA with Collision Avoidance (CSMA/CA): Devices try to avoid collisions by using techniques like random backoff.

2. Controlled Access Protocols

In controlled access protocols, devices take turns accessing the medium based on a predetermined schedule or a token passing mechanism.

Examples of controlled access protocols include:

  • Token Passing: A token circulates among devices, and only the device holding the token can transmit.

    • Token Ring: Devices are arranged in a logical ring, and the token passes from one device to the next.
    • Token Bus: Devices are arranged in a logical bus, and the token passes according to a predefined sequence.
  • Polling: A central controller polls each device in turn, asking if it has data to transmit.

3. Channelization Protocols

Channelization protocols divide the available bandwidth into separate channels, allowing multiple devices to transmit simultaneously without interference.

Examples of channelization protocols include:

  • Frequency Division Multiple Access (FDMA): The bandwidth is divided into separate frequency bands, with each device assigned a specific band.

  • Time Division Multiple Access (TDMA): The bandwidth is divided into time slots, with each device assigned specific time slots.

  • Code Division Multiple Access (CDMA): Devices use different codes to transmit on the same frequency band simultaneously.

Random Access Protocols in Detail

Random access protocols are particularly important in networks where traffic is bursty and unpredictable. Let's explore some of these protocols in more detail:

ALOHA

ALOHA was one of the first random access protocols, developed at the University of Hawaii in the early 1970s. It allows devices to transmit whenever they have data to send, without any coordination.

Pure ALOHA

In Pure ALOHA:

  • Devices transmit whenever they have data to send.
  • If a collision occurs, devices wait for a random amount of time before retransmitting.
  • The maximum channel utilization is about 18.4%.

Slotted ALOHA

Slotted ALOHA improves upon Pure ALOHA by dividing time into discrete slots:

  • Devices can only transmit at the beginning of a time slot.
  • If a collision occurs, devices wait for a random number of time slots before retransmitting.
  • The maximum channel utilization is about 36.8%, twice that of Pure ALOHA.

Carrier Sense Multiple Access (CSMA)

CSMA improves upon ALOHA by having devices listen to the medium before transmitting:

  • If the medium is idle, the device transmits.
  • If the medium is busy, the device waits until it becomes idle.

CSMA with Collision Detection (CSMA/CD)

CSMA/CD, used in traditional Ethernet, adds collision detection to CSMA:

  • Devices listen to the medium while transmitting.
  • If a collision is detected, devices stop transmitting immediately and send a jam signal.
  • After a collision, devices wait for a random amount of time before retrying.

CSMA with Collision Avoidance (CSMA/CA)

CSMA/CA, used in wireless networks like Wi-Fi, tries to avoid collisions:

  • Before transmitting, devices wait for a random amount of time (backoff).
  • Devices may use a Request to Send (RTS) / Clear to Send (CTS) mechanism to reserve the medium.
  • Devices may use a Network Allocation Vector (NAV) to track when the medium will be free.

Controlled Access Protocols in Detail

Controlled access protocols provide more orderly access to the medium, which can be beneficial in networks with high traffic loads.

Token Passing

In token passing protocols, a special frame called a token circulates among devices. Only the device holding the token can transmit data.

Token Ring

In Token Ring:

  • Devices are arranged in a logical ring.
  • The token passes from one device to the next in the ring.
  • When a device receives the token, it can transmit data for a limited time before passing the token to the next device.

Token Bus

In Token Bus:

  • Devices are arranged in a logical bus.
  • The token passes from one device to another according to a predefined sequence, not necessarily based on physical connections.

Polling

In polling protocols, a central controller polls each device in turn, asking if it has data to transmit:

  • The controller sends a poll message to each device in sequence.
  • When a device receives a poll message, it can transmit data if it has any.
  • After transmitting or if it has no data, the device sends a response to the controller.

Channelization Protocols in Detail

Channelization protocols divide the available bandwidth to allow multiple devices to transmit simultaneously without interference.

Frequency Division Multiple Access (FDMA)

In FDMA:

  • The bandwidth is divided into separate frequency bands.
  • Each device is assigned a specific frequency band.
  • Devices can transmit continuously in their assigned band.

Time Division Multiple Access (TDMA)

In TDMA:

  • The bandwidth is divided into time slots.
  • Each device is assigned specific time slots.
  • Devices can transmit only during their assigned time slots.

Code Division Multiple Access (CDMA)

In CDMA:

  • Devices use different codes to transmit on the same frequency band simultaneously.
  • Each device is assigned a unique code.
  • The receiver can extract the data from a specific device using its code.

Comparison of MAC Protocols

Each type of MAC protocol has its advantages and disadvantages, making it suitable for different network scenarios:

Random Access Protocols

Advantages:

  • Simple to implement
  • No central controller needed
  • Works well with bursty traffic
  • Devices can join or leave the network easily

Disadvantages:

  • Performance degrades under heavy load
  • Collisions waste bandwidth
  • No guaranteed access time

Controlled Access Protocols

Advantages:

  • No collisions
  • Fair access to the medium
  • Predictable performance under heavy load
  • Guaranteed access time

Disadvantages:

  • More complex to implement
  • Requires coordination among devices
  • Token loss or controller failure can disrupt the network
  • May waste bandwidth if devices have no data to send

Channelization Protocols

Advantages:

  • No collisions
  • Guaranteed bandwidth for each device
  • Simple to implement

Disadvantages:

  • Wastes bandwidth if devices have no data to send
  • Fixed allocation may not adapt well to changing traffic patterns
  • Limited number of channels available

Detailed Topics

In the following sections, we will explore some of these MAC protocols in more detail:

  1. Random Access Protocols - Protocols where devices can transmit whenever they have data to send
  2. Pure ALOHA - The original random access protocol
  3. Slotted ALOHA - An improved version of ALOHA with time slots

Test Your Knowledge

Take a quiz to reinforce what you've learned

Exam Preparation

Access short and long answer questions for written exams

Share this page