8.2 Collision avoidance and multiple access in Wi-Fi
In all networks, ‘access’ is a major consideration. ‘Access’ in this context means ‘access to the underlying communication medium in order to send and receive data’; and by ‘underlying communication medium’ we mean things like cables, radio channels and optical fibres.
If many people use the same medium, the term ‘multiple access’ is used. Designers of multiple access systems have to deal with questions like ‘How do we ensure that one person’s data doesn’t interfere with someone else’s?’ and ‘How do we ensure that all users get fair access to the medium?’
The procedure used for multiple access in Wi-Fi is effective, in the sense that it can cope with many users in a small area, but at the cost of increased latency, or delay. As you will see in the following video, delays are part of the system used for multiple access in Wi-Fi. This connects with the video you saw at the end of Section 2.1.
Now watch the video below, which is about 6 minutes long. It is narrated by a colleague.
Collision avoidance and multiple access in Wi-Fi
This animation looks at how Wi-Fi allocates the use of the radio channel among its various users. The way it’s done in Wi-Fi is very different from the way it’s done in cellular mobile communications (such as 3G and 4G).
In cellular mobile communications, the base station controls how the communication resource is shared out among users’ devices. Wi-Fi networks can work in a similar way, with the access point controlling the individual devices, but this type of Wi-Fi network is rare. It’s much more common to use the so-called distributed coordination function, or DCF, where the responsibility for sharing access is distributed among all the devices in the network.
In the DCF, the access point is not privileged – it gets access to the radio channel in the same way that other devices in the network do. I will refer to all devices in the network as nodes. A node can be an access point, a Wi-Fi-enabled computer, a smartphone, a wireless printer, or any other Wi-Fi-enabled device.
The access point does have a special role in allowing other devices onto the network (through the use of passwords and so on), but the way it determines when to transmit is the same as the way other nodes on the network do it.
Before we look at the distributed coordination function, it’s useful to establish some terms. An access point and the nodes associated with it, under the control of a common coordination function, is called a basic service set (or BSS).
This set of nodes could be a BSS if all the devices were communicating with the access point.
A BSS is identified to Wi-Fi users by a service set identifier (SSID). This in effect is the network name, such as Sarah’s Network. Among other things, the SSID enables the user of a device to see which networks are available, and to choose one to connect to.
Coordination of network nodes is needed to prevent collisions like these. Collisions cause signal corruption and loss of data. The distributed coordination function ensures that only one device at a time transmits. It does this through a ‘listen before transmit’ protocol. The official name for this protocol is carrier-sense multiple access with collision avoidance, or CSMA/CA.
Before transmitting data, all nodes monitor the radio channel that is being used by the SSID that the nodes are intending to connect to. The same radio channel might also be in use by another nearby SSID. I’ll come back to that point later.
When the channel is clear, nodes with data to transmit wait a fixed length of time. I’ll call this the check period. At the completion of the check period, provided the channel has remained clear, a period called the ‘contention window’ begins. At the start of the contention window, each waiting node starts counting down from a random value chosen by itself. This is called ‘backing off’.
It’s extremely unlikely that more than one device will back off from the same number, so whichever node reaches zero first gains control of the channel. Provided the channel has remained clear during the contention window, the successful node starts to transmit all its frames in sequence.
A frame consists of a data payload, with headers indicating the destination MAC address, and other control data. It usually also incorporates error detection or correction data. A typical payload for a frame would be an Internet Protocol packet, which would have the IP address of the destination.
Other nodes with data to transmit that were also backing off must start the whole process again, beginning by monitoring the channel for the check period. But during the next contention period, they count down only the remainder of their back-off period from the previous attempt. This increases their likelihood of success.
You might wonder what the point of the check period is. Why doesn’t the contention period begin immediately the channel is clear?
The point of the check period is to enable certain types of traffic to be given priority over others. Priority is enabled by specifying a short check period for certain types of traffic.
For example, if a node has just completed a transmission, it will expect to receive an acknowledgement very soon afterwards. Acknowledgements therefore should have priority over new transmissions.
Priority is achieved by allocating a short check period to acknowledgements. This guarantees they will be transmitted before new data, which has a longer check period.
The collision avoidance protocol means that Wi-Fi networks behave quite well together, even when there’s a high density of networks, as you often get in urban areas.
These are Wi-Fi signals in the 2.4 GHz band detected in a shopping centre. This density of signals is not unusual for a busy location.
The waiting periods involved in CSMA/CA mean that the radio channel is not used as efficiently as it could be if there were centralised control. This has led to the use of frame aggregation in Wi-Fi versions 802.11n and 802.11ac. In these Wi-Fi versions, when a node is finally able to transmit, it can send several aggregated frames at once rather than a series of frames.
Nevertheless, delay-sensitive traffic such as voice or video is not well served by the process I have described.
Activity 2 Test yourself
1. After the first frame of someone’s data has been successfully transmitted, subsequent frames in the same data transfer are given a short check period. What is achieved by using a short check period in this case?
It should ensure that all frames are sent in unbroken succession, without the need to enter a contention period again. Going into a contention period would probably result in loss of control of the radio channel, and hence cause delay.
2. An advice column in a magazine says: ‘If your neighbour is using the same Wi-Fi channel as you, change your Wi-Fi channel so that you don’t interfere with each other.’ The advice is good, but the reason is wrong. Explain.
The CSMA/CA system used in Wi-Fi ensures that two users on the same channel who are within range of each other do not use it simultaneously. So there will be no interference. However, there could be additional delays before each user gets access to the channel if both neighbours use the Wi-Fi intensively. To reduce the risk of delay, it would be sensible to switch to a channel that is not being used (although this is not always possible in very busy areas).