A Word in Edgewise: Contention Methods in IT

In any communication protocol, there has to be a way to organize things. Think of it like having a conversation. You can’t simply speak over everyone else whenever you please. If everyone spoke at the same time, it would be incredibly difficult to hear or be heard intelligently.
The same general principle applies to IT and IoT — and is called contention. Simply put, it can be understood as “When do I talk?”. Conversely, there are protocols that are so-called contention-free, which have this all set out in advance.
Need to Learn Cisco Networking Skills?
If you're new to networking or need to hone your existing skills, start with Cisco. You'll find a wide variety of Cisco training at CBT Nuggets. In addition to courses for all expertise levels, you'll also find training targeted to specific job roles.
Once you have the basics of networking down, you can expand into more specialized areas such as security or the cloud. Sign up for a free, 7-day trial to start leveling up your networking skills.
What Types of Protocols Must Contend?
Protocols can be more or less sorted into two categories, based loosely on how access is required to the information. Categories that do not contend or contention-free protocols can also be described as Scheduled-Access. The majority of protocols we run into in this regard are of the second type, though, which we call random access.
It’s what it says on the tin. This means that the data either on the device, or the data the device is set to pass back and forth is accessed, from its perspective, accessed at random. There is inherently no way to know when access will be needed or that there isn’t a method or capability to predict that demand to a level in which it can be scheduled. All random-access protocols must therefore contend for the medium that it transmits on or over. The most common of these protocols we will discuss here: ethernet and Wi-Fi, or 802.3 and 802.11.
Ethernet: CSMA/CD Basics: What are CSMA and CD?
CSMA/CD stands for carrier sense multiple access with Collision detection. We discussed multiple people speaking at the same time before. This is essentially what a collision is. A collision in networking terms describes the effect of multiple devices attempting to use the same physical method of transmission at the same time or in the proper terms the same transmission medium. In Ethernet’s case, this is usually the copper wires, but isn’t always.
It’s important to remember that you can encapsulate other protocols within a secondary one. You could theoretically send ethernet frames over Wi-Fi if you had a good enough reason. The format would just be different, with the entire frame being used as the data payload. Ethernet, therefore, needs a way to manage who is talking, or contention as we described before. This is the multiple access part of the equation. Carrier sense describes how ethernet does this, by sensing what is on the carrier, or in this case the wire.
Collision detection gives us our first clue on how it does this at a basic level. As ethernet is a full-duplex medium, meaning it can send and receive at the same time, a network interface card (NIC) can be listening and sending at the same time. Before transmitting, it first listens to the wire to see if any other transmissions are coming. If nothing is coming, it is considered to have “won” the contention and transmits its first bit.
If it detects no collisions and nothing has begun transmitting, then the NIC then begins transmitting the rest of what it needs to. If during the transmission it detects someone else transmitting, then it will halt until it no longer hears any transmissions, wait a pseudorandom amount of time and begin transmitting again if the line is “quiet”.
This way, all transmissions have the best chance of getting through without a chance of interference, collision, or other potentially data-destroying events. Keep in mind this whole process is exceptionally fast, so it seems to the human observer to be an uninterrupted stream of bits unless something extraordinary is happening.
Wi-Fi: CSMA/CA
Unlike, wired networks like ethernet and fiber, Wi-Fi is a half-duplex medium. This means that the radio has to make a choice: it can be transmitting or receiving, but not both at the same time. There are long, involved physics reasons for this both on the air and involving the way radios and antennas work.
But the easy way to think about it is how it’s nearly impossible for a person to be telling a story and listening to someone else at the same time. Things get garbled and lost. Because it cannot do both, it cannot use Ethernet’s ability to listen for things that would cause collisions and instead has to use another method (or suite of methods) and hope for the best.
This is called CSMA/CA, or carrier sense multiple access with collision avoidance. Instead of detecting and compensating for collisions, it instead tries to avoid them entirely. How it does this is an interesting bit. Though it does have some semblance of a way to do this indirectly. Wi-Fi makes it so that every single frame must be responded to with an acknowledgment frame (ACK). There is a slight exception in 802.11ac and later where you can ACK a lot of transmissions at once, but it can be safely ignored for our purposes. This is a high-level overview of how that happens.
Wi-Fi: Physical Carrier Sense
The first line of defense within the 802.11 operations to make sure no one else is talking is called the physical carrier sense. It has two goals- 1) To make sure that no frame is incoming that it needs to decode. The second is that The medium is not otherwise busy. In this case, as ethernet is generally a wire, this is the “air”— the RF space in the frequency that we will be transmitting in. To achieve these goals, it carries out a clear channel assessment (CCA) in two parts.
Wi-Fi: CCA, Signal Detect, and Energy Detect
The CCA begins with the signal detect mechanism or SD. SD and energy detect (ED) have two different values, or “thresholds” which it uses to make sure the channel is clear. Signal detect is primarily designed to see if there is anything on the channel of sufficient power (think of it like volume) for the radio to receive or demodulate. It does this by looking for something that all transmissions have in front of them, called the preamble. (Ethernet has one too)
The preamble has the role of helping stations sync up and notifying them that a transmission they should be able to understand is coming. To a degree, vendors have some control over this threshold, but it’s generally looking for signals that are 4dB over the noise floor. Noise floor refers to the point where transmissions blend into the cosmic and local noise and become unintelligible.
Energy detect, the second half of our CCA, is instead meant to check for non-802.11 transmissions. This would include just about anything that the station can’t decode. It checks the channel that the station intends to transmit on, and specifically has a threshold of 20dB over what the signal detect is looking for. For example, if the signal detect is looking for a -80dBm signal, this would be looking for a non-802.11 signal of a power -60dBm or higher).
Instead of something that we need to listen to, this is checking and making sure we aren’t interfering with others, and they’re not going to step on us as well. This could be anything from a wireless camera that uses a proprietary method, or even an electric motor consuming a lot of power. If the station passes this, it is then ready to begin 802.11’s transmission process. Contention goes a bit further than this, but this is the basics of how it works.
delivered to your inbox.
By submitting this form you agree to receive marketing emails from CBT Nuggets and that you have read, understood and are able to consent to our privacy policy.