Javatpoint Logo
Javatpoint Logo

Medium Access Control in Computer Network

What is Medium Access Control?

A sublayer of the Data Link Layer (Layer 2) in the OSI (Open Systems Interconnection) model of computer networking is called Medium Access Control (MAC). Its main duty is to control access to a network's shared communication medium, ensuring that various devices can transmit data effectively and fairly over a common communication path like a wired Ethernet or wireless Wi-Fi network.

Function of Medium Access Control

A computer network's Medium Access Control (MAC) layer performs several crucial tasks to control access to the shared communication medium.

Its main responsibility is preventing collisions while ensuring multiple devices can transmit data fairly and efficiently over a shared communication channel.

The MAC layer performs the following primary tasks:

  • Access Control: The MAC layer controls which device can transmit data at any given time by controlling access to the shared communication medium. It employs various access control techniques to control how devices compete for access to the medium. Contention-based (like Carrier Sense Multiple Access with Collision Detection or CSMA/CD) and contention-free (like token passing) techniques can be used.
  • Frame Addressing: Networked devices on the same network segment are uniquely identified by their MAC addresses, also called hardware or physical addresses. The MAC layer includes the source and destination MAC addresses in data frames to identify the sender and recipient of the data.
  • Frame Formatting: The MAC layer packages data from the higher layers (typically the Network Layer) into frames that can be transmitted over the network medium. These frames contain data, control information, information for checking for errors, and information for addressing.
  • Error detection: Many MAC protocols include error-checking components to identify transmission errors. This guarantees the accuracy of the data transmitted through the medium. The MAC layer may ask for retransmission of the frame if a mistake is found.
  • Frame detection and collision handling: Collisions can happen when multiple devices try to transmit data simultaneously over a shared communication medium like Ethernet. Detecting collisions and putting collision resolution mechanisms into place to lessen their effects falls to the MAC layer. For instance, when CSMA/CD detects collisions, it starts a back-off mechanism that sends data again after an arbitrary amount of time has passed.
  • Flow Control: Some MAC protocols employ flow control to ensure that data is transmitted at a rate the recipient device can handle without experiencing data loss or overflow. Flow control mechanisms may use feedback from the receiver to the sender to change transmission rates.
  • Address Resolution: In Ethernet networks, the MAC layer uses the Address Resolution Protocol (ARP) to translate addresses from higher layers (like IP addresses) to MAC addresses. The local network segment's corresponding MAC address is found using ARP, which maps the destination IP address to it.
  • Broadcast and Multicast: The MAC layer supports both broadcasting and multicasting, allowing for the sending of frames to various groups of devices (multicast) or all devices on a network segment (broadcast) as needed.
  • Security: Some MAC layer protocols include security features like encryption and authentication to protect data and ensure that only authorized devices can access the network.

The MAC layer's precise roles and behaviours may change depending on the network technology and standard. Different MAC protocols are designed to meet the network's needs and the communication medium's characteristics (wired Ethernet, wireless Wi-Fi, etc.).

How does MAC Work?

Every MAC protocol has unique guidelines and controls for controlling who has access to the shared communication medium. Here, I'll give a brief explanation of how MAC typically operates:

  1. Carrier Sense
    Many MAC protocols, such as Carrier Sense Multiple Access (CSMA), begin by listening to the communication medium to see if any other devices are currently using it. The transmission of data can continue if the medium is not in use.
  2. Contention or Reservation
    Depending on the MAC protocol, devices may either compete for access to the medium or reserve it beforehand. Ethernet, for instance, employs contention-based techniques, whereas Token Ring employs a reservation-based strategy.
    • Contention-Based Access: Devices may attempt to transmit when the medium is idle after checking for contention. However, collisions may happen if multiple devices identify a space simultaneously, in which case collision detection and resolution mechanisms are used. Devices in CSMA/CD (used in conventional Ethernet) watch for collisions and back off for an arbitrary time before trying to retransmit.
    • Reservation-Based Access: With reservation-based access, the medium is accessed by devices. Devices pass a token, for instance, in Token Ring networks, to indicate their authorization to transmit data. To prevent collisions during transmission, only the device holding the token can send data.
    • Addressing
      A device includes the source and destination MAC addresses in the data frame when it wants to send data. These addresses support sender and receiver identification on the network segment.
  3. Frame Transmission
    When a device connects to the medium, it sends a data frame that includes the actual data, control, and addressing information. Electrical signals, such as radio waves in Wi-Fi or electrical pulses in Ethernet, transmit the frame over the network medium.
  4. Error Detection
    Frame Check Sequence (FCS) in Ethernet is one example of an error-checking mechanism used by the MAC layer to find transmission errors. If errors are found, the frame might be discarded, or another transmission might be requested.
  5. Recognition
    The receiver must acknowledge a successful frame reception under some MAC protocols. This acknowledgement shows that the data was successfully received and could lead to additional actions on the sender's end.
  6. Flow Control
    Flow control mechanisms may occasionally control the data transmission rate to prevent congestion and ensure effective data transfer.
  7. Broadcast and Multicast
    The MAC layer enables sending frames either as a broadcast to all devices on a network segment or as a multicast to particular groups of devices.
  8. Address Resolution
    In Ethernet networks, the MAC layer uses Address Resolution Protocol (ARP) to convert addresses at higher layers, such as IP addresses, to MAC addresses.

It's crucial to remember that the MAC layer's precise functionality can vary greatly depending on the network technology and standard. Numerous MAC protocols have been developed to meet various network environments' unique needs and difficulties.

Limitation of Medium Access Control

There are some limitations of medium access control in computer networks:

  • Restricted to Shared Medium: Shared network mediums are the only medium for many MAC protocols. MAC protocols might not be the most effective option when dedicated point-to-point connections are required (such as point-to-point links or dedicated circuits).
  • Overhead: Control data, addressing, and collision detection mechanisms are all added by MAC protocols. The network's actual data throughput may decrease due to this overhead.
  • Latency: If applicable, accessing the medium and collision resolution can cause network communication to have variable and occasionally unpredictable latency.
  • Limitations on Scalability: Due to the inefficiency of the contention process, some MAC protocols may not scale well to extremely large networks with many devices competing for access.
  • Low Utilization Causes Inefficiency: MAC protocols may add irrational delays and contention overhead in networks with low utilization, which can lower overall efficiency.
  • Congestion Vulnerability: Network congestion can increase contention and collisions and reduce network performance for MAC protocols based on contention.
  • Security issues: It's possible that MAC protocols don't come with strong security features by default. It might be necessary to use additional security measures, like authentication and encryption, to protect data transmission at higher layers.
  • Limited Quality of Service (QoS) Support: Although some MAC protocols support fundamental QoS mechanisms, they might not offer fine-grained control over network prioritization and traffic management.
  • Security issues: It's possible that MAC protocols don't come with robust security features by default. Potential security risks may arise if unauthorized devices connect to the network. Higher layers frequently need additional security measures like authentication and encryption.

To maximize the advantages and minimize the drawbacks, selecting the appropriate MAC protocol is crucial based on the network's unique requirements, including its size, topology, and traffic characteristics. Different MAC protocols are suitable for various scenarios, and depending on the situation, they may or may not be effective.

Youtube For Videos Join Our Youtube Channel: Join Now


Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA