CSMA/CA - Carrier Sense Multiple Access with Collision Avoidance
CSMA is a basic method that controls the communication of multiple participants on a shared and decentralized transmission medium. However, this is now available in three different variants, which depend on the transmission medium. While CSMA/CA is mainly used in wireless networks, CSMA/CD was developed for Ethernet, and CSMA/CR is used in controller area networks (CAN), which are mainly used in cars and machines.
To understand exactly what is behind Carrier Sense Multiple Access with Collision Avoidance, it makes sense to look at the components individually:
- Carrier sense (CA): The initial idea is that participants may only send data over the network if the transmission medium is free. The carrier status detection checks the channel any time, and data is not sent until it’s available.
- Multiple access (MA): Several stations share a transmission medium. It is crucial for functioning communication that all of them adhere to a binding protocol.
- Collision avoidance (CA): A complex schedule tries to ensure that two or more participants do not start a transmission at the same time to avoid collisions. If overlapping does occur, this will be detected and the transmission will be tried again.
- What is CSMA/CA and what is its purpose?
- CSMA/CA vs. CSMA/CD
- How CSMA/CA works
- The advantages and disadvantages of CSMA/CA
- What are coordinated multiple access protocols?
What is CSMA/CA and what is its purpose?
In a local area network (LAN), all network participants share a transmission medium – a cable, the so-called bus. Wireless networks naturally don’t use cables, but even with WLAN, all devices involved send and receive using only one transmission medium, namely a certain radio range. In this respect, WiFi (IEEE 802.11) is comparable to the early half-duplex Ethernet networks. So, there must also be a protocol for a wireless network that regulates the use of the medium.
The most important rule, which you’ll know from communication situations when there are several participants (e.g. a conversation with the family at the dinner table), is: only one person may send their information at once. If everyone speaks at the same time, it’s confusing and no-one can understand anything. The posts can also overlap in networks, in this case in the form of data packets. This is called a collision, when the data packets meet and alienate their contents.
CSMA/CA tries to reduce the frequency of these collisions and provide a plan at the same time on how to proceed if a collision does occur. The protocol is also important because the transmissions in the wireless networks cannot run in the same order (due to the technology used) as they would have done with a cable. In a decentralized network, it is necessary for all participants to follow a set of rules and organize the communication among themselves.
The hidden station problem
The technical differences between wired and wireless networks also lead to the so-called hidden station problem. Stations in a wireless network have a limited range, so that it could be that participants in a network don’t even recognize each other.
It is conceivable, but not improbable, for two stations not to recognize one another, but to want to simultaneously reach a station that is located between them. Transmissions can overlap at the receiving node, meaning data gets lost. Both transmitters do not detect the collision and don’t start a new delivery attempt. CSMA/CA alone cannot solve this problem, which is why an optional extension was created: RTS/CTS (“Request to Send” and “Clear to Send”).
CSMA/CA vs. CSMA/CD
CSMA/CA adapts the collision handling method (CSMA/CD) used in half-duplex Ethernet networks to face the challenges that wireless networks pose. CSMA/CD tries less to avoid collisions. Instead, the protocol understands collisions as a matter of fact and establishes a mechanism for network participants instructing them how to proceed in the event of a collision so that another one doesn’t happen straightaway on the next attempt. Backoff – a random amount of time that stations must wait after a failed transmission so that both participants don’t start sending information at the same time – accomplishes this.
Wireless networks cannot be monitored as securely as wired networks. Collisions may be caused by a second transmitter out of the range of the first, and neither can recognize the other’s attempts to send information. It’s necessary, then, to reduce the probability of collisions. CSMA/CA brings the backoff forward in the process and uses it before the first delivery process, making it less likely for participants to simultaneously start a transmission and cause a collision.
How CSMA/CA works
The basic idea behind CSMA/CA is the “Listen Before Talk” (LBT) principle. This means that the line has to be checked to see if it’s free (“idle”) before the station can start a transmission. But this is just the first step. Further functions within the procedure ensure that collisions can be avoided to a large extent.
Distributed coordination function (DCF)
Within CSMA/CA, the distributed coordination function (DCF) controls the time a station waits before initiating transmission in a free medium. DCF also assigns certain time slots to network participants for further actions, creating a binding time structure. This procedure is the focus of collision avoidance: a complex time structure that makes it possible to avoid collisions. DCF takes various intervals into account when creating the time structure.
- DCF interframe space (DIFS): In the first step, participants must monitor the network for the duration of the DIFS to determine whether it’s currently free. For CSMA/CA, this means that no other station within range is sending out a transmission at the same time. The DIFS results from the SIFS almost double the slot time, which is between 28 and 50 µs long.
- Contention window: If participants determine that the channel is free, they wait a random amount of time before they start sending. This duration corresponds to the contention window. This time window doubles with each collision and corresponds to the binary exponential backoff (BEB) that is familiar from CSMA/CD.
- Short interframe space (SIFS): After sending the data packet, the recipient node sends a notification – if the RTS/CTS procedure is also utilized. However, this station also waits for a fixed time before sending. SIFS is the time it takes to process a data package. The duration depends on the IEEE-802.11 standard and is between 10 µs and 16 µs.
The slot time is the time it takes data to pass through the maximum length of the network. For wireless networks, this depends on the standard used and is between 9 µs and 20 µs.
Request to send and clear to send (RTS/CTS)
The frames “Request to Send” (RTS) and “Clear to Send” (CTS) are part of the optional extension CSMA/CA RTS/CTS. This procedure is upstream of the actual data transmission. If a participant determines that the transmission medium is free, the device first sends an RTS frame to the participant that is to receive the data. With this, the output computer makes it clear that it wants to start a transmission and will occupy the transmission medium for a certain time.
The receiver, in turn, sends a CTS frame to the original sender. As with the RTS frame, all other participants in the range are informed that the transmission is currently occupied and the transmitter is enabled for transmission. Only then does the original device start transmitting the data. Now it is not possible for the participants in a wireless network to detect collisions or other interference during transmission. For this reason, the receiving station needs to send an acknowledgement (ACK) when the data packet has arrived correctly.
If the ACK frame doesn’t appear, the sender of the data assumes that a complication has occurred and resends the data packet. The station has a preferential right to use the medium and doesn’t have to wait again for the channel to be free. The three frame types each consist of several fields.
- Frame control: the FC field contained in each 802.11 frame is 2 bytes (16 bits) and again divided into several elements:
- Protocol version: specifies the version of the protocol used
- Type: specifies whether it is a control frame (as with RTS/CTS and ACK), data frame, or management frame
- Sub-type: specifies the type of frame by defining one of the 25 sub categories
- To distribution system: is set when the frame goes to a distribution system
- From distribution system: is set if the frame comes from a distribution system
- More fragments: only has content if more frames follow (only relevant for data frames and management frames)
- Retry: specifies whether and how often the frame has already been sent
- Power management: shows the power saving mode
- More data: specifies that more data should be sent
- WEP: indicates whether the data is encrypted with WEP
- Order: tells the recipient whether the data is sent in the correct order
- Duration: specifies the time the transmitter needs for data transmission (this information is crucial for the network allocation vector and has a size of 2 bytes)
- Receiver address: contains the MAC address of the receiver (6 bytes)
- Transmitter address: contains the MAC address of the sender (6 bytes); only required for RTS, not for CTS, and ACK
- Frame check sequence: the 4-byte block check sequence is a checksum that enables the receiving station to determine whether the data frame has arrived as planned. The sender calculates the checksum from the data of the frame. The same process also takes place on the receiver’s side when the frame has arrived. If the receiver’s result matches what the sender attached to the frame as FCS, the transmission was successful.
Except for the field that specifies the transmitter address, all fields are contained in RTS, CTS, and ACK. However, the sender field is only of interest when first contacting the recipient, so that the recipient knows which node he is now communicating with.
By extending the CSMA/CA protocol with RTS/CTS, it’s possible to reduce collisions on the initial RTS frame. It is still likely that two participants will send a request to send to the same station at the same time. In cases like this, however, the receiver does not send a CTS frame because the RTS frames have not arrived correctly. So, RTS/CTS can solve the hidden station problem: even if the two transmitters don’t recognize each other due to the limited range, only the RTS frames are at risk and not the actual data. CSMA/CA then takes effect and the transmission can take place in an orderly fashion.
The RTS/CTS exchange solves the hidden station principle, but the extension causes another difficulty: the exposed station problem. The situation is initially the same as with the hidden station problem: one station is in the middle of two other stations so that they cannot reach each other. One of the two devices now wants to send data to the station in the middle. All accessible nodes receive the CTS frame that stops them from broadcasting. This avoids the hidden station problem, but creates a new one.
A third station is now prevented from transmitting, even if a completely different, fourth station would have been the destination of the transmission. This transmission would not cause a collision, but it still has to be prevented, which leads to the entire network slowing down.
Network allocation vector (NAV)
Before a device in the network starts a transmission, it first sends information (in the duration field of the RTS frame) to all other participants. The station reveals how long the network will be occupied by the transmission. Every other device enters this information in its very personal network allocation vector (which is not really a vector from a mathematical point of view). This is managed internally and specifies the time when a delivery attempt is possible again. The network allocation vector (NAV) counts down continuously and is only replenished by new information from other stations.
A NAV can increase the timer by a maximum of 33ms (32.767 µs). This is the maximum duration for which a transmitter may block the medium. The devices in the network are inactive while the network allocation vector has not yet expired. This saves energy. Only when the counter is set to 0 does the subscriber become active again and check the network. The NAV is not only adjusted by the RTS, but is also influenced by CTS and ACK. The latter is the signal for all participants to reset the NVA to 0, when the medium is free again.
The CSMA/CA procedure at a glance
If participants in a wireless network follow Carrier Sense Multiple Access with Collision Avoidance, certain steps must be adhered to. First, the stations monitor the transmission medium. When it comes to WLAN, this means that carrier sense monitors the radio channel and checks whether other network participants – as long as they are visible to the respective device – are currently transmitting.
If it turns out that the transmission medium is currently occupied, a random backoff is initiated: the station waits a random amount of time until a new check starts. All other stations, which are not busy with sending or receiving, experience the same. The random waiting time ensures that the participants do not start to check the network at the same time and cannot start transmitting data at the same time. However, this only happens if the station is not already aware that the medium is occupied due to the network allocation vector (NAV).
If the network is free, the station initiates DCF. First, the channel is checked more thoroughly for the duration of DIFS. If it remains free for this time, a random backoff starts and only then does the RTS/CTS exchange begin – if this additional mechanism is used. If the request to send has successfully arrived at the receiver and no collision has occurred, the sender receives permission from the CTS frame to occupy the transmission medium.
As this happens, all other participants are informed that the network is currently in use. This causes them to raise their network allocation vector again and wait to try again to see if the channel is free. Then the station starts the transmission. When this is finished, the receiver waits for the duration of an SIFS and then responds with an ACK frame to confirm to the sender that everything has been fully received and to set the network allocation vector to 0, showing that the network is free for a new transmission.
The advantages and disadvantages of CSMA/CA
CSMA/CA solves some problems that occur in wireless networks and cannot be solved by CSMA/CD. However, the process is not without its disadvantages: on the one hand, certain problems cannot be solved completely and, on the other hand, CSMA/CA brings new difficulties along with it.
|Helps prevent data collisions||Longer waiting times|
|Thanks to feedback, no data is unnoticeably lost||Causes additional traffic|
|Avoids unnecessary data traffic with the RTS/CTS extension||Solves the hidden station problem only by using RTS/CTS extension|
|Creates the exposed station problem through using RTS/CTS|
What are coordinated multiple access protocols?
Since the CSMA/CA procedure is far from perfect, efforts have been made to expand it. This is how weak points are eradicated. Two procedures, both of which follow the concept of coordinated multiple access protocols have been developed, but are hardly used for various reasons. Coordinated multiple access protocols establish a central organizational point: the access rights of the individual stations on the transmission medium should no longer be coordinated exclusively with one another. Instead, requests run via the access point (e.g. via the WiFi router).
Point coordination function
The point coordination function (PCF) is additionally integrated into the CSMA/CA procedure and replaces or supplements the distributed coordination function (DCF). The access point acts as a coordinator (point coordinator) and specifically addresses the stations within the network. No-one is allowed to occupy the transmission medium until this has been done. The coordinator has a polling list for the order of the individual stations.
According to this list, each network participant is asked either simply one after the other (or in order of priority) whether they wish to make a transmission. Before the access point starts the request, however, it has to wait for a certain time just like with DFC. The PCF interframe space is one slot time shorter than the DIFS and has a higher priority, so PCF takes effect earlier than DCF.
The method offers an approach to solve the hidden station problem: the required range can be halved if the access point is well positioned. PCF means that participants no longer have to recognize each other. The access point just needs to be placed in the middle and can reach all stations in a star shape.
However, the point coordination function creates another weak point: to use the technology, all network participants must be able to use PCF. However, this is by no means always the case. When devices are not participating in the PCF process, they and their transfer requests are simply ignored. That is why an alternating system has been developed: PCF and DCF can alternate to give all devices in the network the possibility of transmission. The access point provides two time periods for this. Firstly, there is the contention free period (CFP), in which PCF ensures coordinated multiple access, and the contention period (CP), in which DCF applies and collisions as described above are avoided using CSMA/CA. This alternation is initiated by a beacon frame, which the coordinator sends to all stations.
Hybrid coordination function controlled channel access (HCCA)
The other method with coordinated multiple access protocols, HCF controlled channel access, is strongly oriented towards the PCF method. However, HCCA regulates the change between the contention period and the contention free period differently. Instead of an alternating system, HCCA established the option that allows the access point to switch from CP to CFP at any time – which is the controlled access phase (CAP) in HCCA. During this period, the hybrid coordinator (also the access point here) coordinates who may send data and when, based on priority. The coordinator determines these via traffic classes (TC), which specify the stations. This way, different priorities can be assigned to different classes.
In addition, with HCCA, the transmission period becomes a transmit opportunity (TXOP). This describes a time during which transmitters may not only send one frame, but as many data frames as possible within the TXOP phase. If a frame is too large for the period, it must be broken open and sent in several parts. This prevents slower stations from slowing down faster ones.
During the contention period, however, enhanced distributed channel access (EDCA) applies. There is also an order of priority behind EDCA. However, this order is not organized by a central point; instead, the participating stations arrange themselves just like with DCF. Nodes that have important traffic to transmit do not need to wait for a full DIFS. Instead, stations like these pause only for the length of the arbitration interframe space (AIFS). There are various AIFs, which are numbered consecutively, depending on the priority. AIFS1 has the highest priority level and is \ smaller than DIFS but longer than SIFS. TXOP also applies to EDCA.