Wifi operates within a signal band. There are multiple channels in each band. Your router / phone usually automatically connects to the channel with the least use.
They use something called “Time-Division Multiplexing” which is a fancy way to say that each client gets just a small time chunk and then have to go back and stand in queue behind the other devices.
Most of the time, most connected devices have nothing to say so the queue is short and there is no actual collisions in the air.
For places where hundreds of people actually need to use the WiFi at the same time, they use multiple “routers”/”access points” so that it becomes like many small WiFi networks instead of one big.
(I have to point out that even though you mentioned “interference” in the title, that’s not what your actual question is asking. So I will ignore the interference part – that’s what happens between different WiFi networks – and will focus on what happens within the same WiFi network)
Imagine 2 people trying to walk through the same doorway, from opposite ends.
First, they “sense” (i.e. see) if anyone is walking through a door right this moment.
If none are, then they both “attempt” to walk through, but if they did it at the same time, the “collide” and bounce back.
Now if they both waited exactly 5 seconds before retrying, they would both bounce back again… But they don’t wait exactly 5 seconds. They wait a random amount of time to retry. So let’s say first guy waited 1 second, and second guy waited 2 seconds.
So, after 1 second, first guys “senses” (i.e sees) if the door way is clear, and since it’s free, he is walking through
After 2 seconds, second guys “senses” the door way, but the first guy is still walking through it… so the second guy backs off again, for a random time, and will try again later.
This “sensing and randomly waiting” is exactly why, as you yourself said, it gets “slower”. But there is no limit on how many people can stand around the door and “attempt” it.
(This is called CSMA/CA – Carrier Sense Multiple Access with Collision Avoidance)
Mind you, this happens extremely fast.
Also keep in mind, since you said “hundreds” of devices you are probably talking about School or Work or Mall WiFi. There isn’t just 1 “doorway” there. There are multiple physical doorways (called “Access Points”, or APs, those physical boxes with antennae). Your phone talks to the closest one.
Furthermore, there are improvements in modern WiFi:
For example, the door way may be large enough to let 2 people walk side by side without colliding, but that only works when everyone follows the same etiquette (for example, stay on the right side). Others still need to “sense” that the doorway is busy when 2 people are already walking through, but it’s better to let 2 through than just 1.
However this breaks when you got an oblivious person that didn’t read the signs attempt to walk through the middle of the doorway. This is what happens with older devices that don’t support the latest WiFi standards… again they slow down the whole network
The first is “frequency division multiple access” (FDMA), where different networks/access points operate on different channels. The devices on a given channel only listen to and talk on a certain frequency range around the nominal channel frequency.
You can think of this like a dogwhistle; if you’d only hear and talk in dogwhistles, then you wouldn’t need to worry about talking over or overhearing other people. Only people like you would hear what you’re saying and vice versa.
The second technique is “carrier sense multiple access” (CSMA), where the devices first listen for a short period before transmitting. If they hear someone else transmitting, they wait for the channel to become available again.
WiFi uses a variant of this technique where the device goes back to sleep for a random or exponentially increasing amount of time if the channel was busy (I do not recall which, but it is not important). This variant is called CSMA with collision avoidance (CSMA/CA).
Lastly, there is some additional signaling from the receiver, which it uses to indicate whether it is currently available for reception; this is used to avoid issues with so-called hidden nodes.
ETA: In regards to hidden nodes: Consider a situation where you’re talking to a friend over a distance; they’ll hear you, just barely, but you won’t hear if someone from the other side of your friend is talking. What happens if the other person is talking to your friend when you start talking? That’s right, they won’t hear you.
This makes you hidden from the other person. The hidden node problem can be solved by shouting a brief “hey” at your friend and then waiting for them to say “hey” back before you start talking.
There is interference and lots of it. To minimize interference and its impact, WiFi protocols use Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA). The key here is “Carrier Sense” whereby each device which wishes to send listens to traffic and, when the transmission ends, requests control of the medium so that it can transmit. If multiple devices request at the same time, there is a collision (caused by RF interference) and each device then waits a variable period of time before retrying. The “variable” part is (for non-QOS service) a random period calculated using a heuristic specified by part of the Distributed Coordination Function (DCF) standard.
[As an aside, this highlights a central difference between WiFi and cellular traffic. The latter has a central controller that directs each device. Your phone is told that that they can transmit x amount in y milliseconds and to expect to receive the next transmission of size z in w milliseconds. And to adjust your transmission power up or down. This is also why cellular data is as energy efficient as it is.]
Other parts of DCF enhance the collision avoidance.
Protocol standards are fascinating and CSMA/CA has many excellent resources available that can easily be followed by a layman once you learn a few conventions such as message flow diagrams and protocol stacks.
I would suggest that you start with older standards and then work forward as additional layers and refinements are added to address shortcomings. The Wikipedia pages are very brief but provide good references.
If you find the topic interesting, then I encourage you to pursue it. The telecom field is one of the best areas of employment within the broader field of computing. (Another being banking and finance.) The jobs are well paid and the working environments are professional. It is also among the most challenging because RF is a limited resource and carriers pay billions to license the bands – therefore they want the absolute best performance that is physically possible. I count myself lucky to have spent nearly 40 years in the field.
The way this works is that the wifi router essentially has a “talking stick” that it hands out to one device at a time, and that device can only talk when it has the stick, and then it gets passed to the next device, and so on and so fourth. The reason why it feels like they’re all connected at the same time is because the talking stick is being passed around thousands of times every second.
This also makes it fantastically easy to jam wifi, because all you need to do is “yell” on that frequency continuously and very loudly. Which is exactly what a microwave oven does to 2.4 Ghz wifi networks on accident and one more reason why 5 Ghz wifi is preferred these days.
However, there are hardware limitations. For example, cheap wifi routers might pass that stick around much slower, so they may only be able to handle a handfull of devices before they start to get bogged down. Another clever trick with enterprise wifi setups, like the ones found in hospitals or hotels, is that you might have one wifi network, but multiple access points operating on different frequencies to connect to it. Each access point has it’s own talking stick, but connects to the same network either through a wired connection, or by talking to other access points on another frequency that’s reserved for access points only. This not only allows you to connect hundreds of devices to the same network, but it also allows you to extend that network over a wide area and balance the load across multiple access points.
They do but IT guys and Router Software is constantly fighting to manage that.
The first trick is frequency changes. WiFi covers radio frequencies between about 900 MHz to 60 GHz at more or less 5 MHz spacing. Practically speaking, this gives you about 15 channels to work with although there’s multiple methods of dividing this range and sometimes channels are merged.
The second trick is to divide by space. You divide the building into zones and assign a router to each one. Add some signal blocking material between zones and assign each zone it’s own WiFi router. The routers themselves are connected to the internet modem via various cables (co-ax is best, fight me) which don’t add to the radio interference.
The last trick is basically timesharing. Every signal sent through WiFi comes with an address and every other computer is told to politely ignore signals not address to it. Every computer sends and recieves messages on a schedule, usually one measured in milliseconds. Naturally, this slows things down so it’s avoided when possible.
Old WiFi and new WiFi (6+) approach it differently.
Old WiFi is like hundreds of people trying to speak up on a conference call. You just start talking and if you accidentally talk over someone else you stop wait a random amount of time and try to talk again and hope they don’t pick the same random delay to start walking.
New Wifi it explicitly schedules everybody and you get a speaking schedule for how long you can talk. If you want to talk you need to request a speaking slot and it’ll be assigned to you. This is obviously way more efficient.
Both old and new also assign different channels. So it’s like being assigned a different walkie talkie channel.
Since old and new WiFi aren’t backward compatible obviously if you have a single old WiFi device on a channel that means it’ll have to revert to just randomly trying and waiting. Hence why you want everyone nearby in an apartment building to upgrade.
They do interfere with each other. That’s why it gets slower. Basically if I want to send a bit of information, the way it works is I send and I listen at the same time. If no one else is transmitting at that moment, what I hear should be what I sent, and we’re good. If someone else is transmitting at the same time (the odds of which increase as there are more people using it), I’ll hear something other than what I sent. Not good, it means I need to send again. The way it works is that, basically, I wait a random amount of time before trying to send again. So the need for me to resend in the first place,and the need for me to wait before doing it slows me down.
Comments
Wifi operates within a signal band. There are multiple channels in each band. Your router / phone usually automatically connects to the channel with the least use.
Frequency of radio is very, very high. 2.4ghz or 5ghz are both incredibly high. How high?
One gigahertz is 1000000000 hertz. Therefore every second your router is able to handle up to 5000000000 operations.
Router talks with every device in turns. Devices know when it’s their turn to talk to router, router can tell which device talks to it every turn.
Edit: this is very large simplification and not entirely accurate. You need eli15 for proper explanation.
They use something called
“Time-Division Multiplexing”which is a fancy way to say that each client gets just a small time chunk and then have to go back and stand in queue behind the other devices.Most of the time, most connected devices have nothing to say so the queue is short and there is no actual collisions in the air.
For places where hundreds of people actually need to use the WiFi at the same time, they use multiple “routers”/”access points” so that it becomes like many small WiFi networks instead of one big.
That’s the thing…. they do collide.
(I have to point out that even though you mentioned “interference” in the title, that’s not what your actual question is asking. So I will ignore the interference part – that’s what happens between different WiFi networks – and will focus on what happens within the same WiFi network)
Imagine 2 people trying to walk through the same doorway, from opposite ends.
This “sensing and randomly waiting” is exactly why, as you yourself said, it gets “slower”. But there is no limit on how many people can stand around the door and “attempt” it.
(This is called CSMA/CA – Carrier Sense Multiple Access with Collision Avoidance)
Mind you, this happens extremely fast.
Also keep in mind, since you said “hundreds” of devices you are probably talking about School or Work or Mall WiFi. There isn’t just 1 “doorway” there. There are multiple physical doorways (called “Access Points”, or APs, those physical boxes with antennae). Your phone talks to the closest one.
Furthermore, there are improvements in modern WiFi:
For example, the door way may be large enough to let 2 people walk side by side without colliding, but that only works when everyone follows the same etiquette (for example, stay on the right side). Others still need to “sense” that the doorway is busy when 2 people are already walking through, but it’s better to let 2 through than just 1.
However this breaks when you got an oblivious person that didn’t read the signs attempt to walk through the middle of the doorway. This is what happens with older devices that don’t support the latest WiFi standards… again they slow down the whole network
WiFi uses three techniques to accomplish this.
The first is “frequency division multiple access” (FDMA), where different networks/access points operate on different channels. The devices on a given channel only listen to and talk on a certain frequency range around the nominal channel frequency.
You can think of this like a dogwhistle; if you’d only hear and talk in dogwhistles, then you wouldn’t need to worry about talking over or overhearing other people. Only people like you would hear what you’re saying and vice versa.
The second technique is “carrier sense multiple access” (CSMA), where the devices first listen for a short period before transmitting. If they hear someone else transmitting, they wait for the channel to become available again.
WiFi uses a variant of this technique where the device goes back to sleep for a random or exponentially increasing amount of time if the channel was busy (I do not recall which, but it is not important). This variant is called CSMA with collision avoidance (CSMA/CA).
Lastly, there is some additional signaling from the receiver, which it uses to indicate whether it is currently available for reception; this is used to avoid issues with so-called hidden nodes.
ETA: In regards to hidden nodes: Consider a situation where you’re talking to a friend over a distance; they’ll hear you, just barely, but you won’t hear if someone from the other side of your friend is talking. What happens if the other person is talking to your friend when you start talking? That’s right, they won’t hear you.
This makes you hidden from the other person. The hidden node problem can be solved by shouting a brief “hey” at your friend and then waiting for them to say “hey” back before you start talking.
There is interference and lots of it. To minimize interference and its impact, WiFi protocols use Carrier Sense Multiple Access with Collision Avoidance (CSMA/CA). The key here is “Carrier Sense” whereby each device which wishes to send listens to traffic and, when the transmission ends, requests control of the medium so that it can transmit. If multiple devices request at the same time, there is a collision (caused by RF interference) and each device then waits a variable period of time before retrying. The “variable” part is (for non-QOS service) a random period calculated using a heuristic specified by part of the Distributed Coordination Function (DCF) standard.
[As an aside, this highlights a central difference between WiFi and cellular traffic. The latter has a central controller that directs each device. Your phone is told that that they can transmit x amount in y milliseconds and to expect to receive the next transmission of size z in w milliseconds. And to adjust your transmission power up or down. This is also why cellular data is as energy efficient as it is.]
Other parts of DCF enhance the collision avoidance.
Protocol standards are fascinating and CSMA/CA has many excellent resources available that can easily be followed by a layman once you learn a few conventions such as message flow diagrams and protocol stacks.
I would suggest that you start with older standards and then work forward as additional layers and refinements are added to address shortcomings. The Wikipedia pages are very brief but provide good references.
If you find the topic interesting, then I encourage you to pursue it. The telecom field is one of the best areas of employment within the broader field of computing. (Another being banking and finance.) The jobs are well paid and the working environments are professional. It is also among the most challenging because RF is a limited resource and carriers pay billions to license the bands – therefore they want the absolute best performance that is physically possible. I count myself lucky to have spent nearly 40 years in the field.
The way this works is that the wifi router essentially has a “talking stick” that it hands out to one device at a time, and that device can only talk when it has the stick, and then it gets passed to the next device, and so on and so fourth. The reason why it feels like they’re all connected at the same time is because the talking stick is being passed around thousands of times every second.
This also makes it fantastically easy to jam wifi, because all you need to do is “yell” on that frequency continuously and very loudly. Which is exactly what a microwave oven does to 2.4 Ghz wifi networks on accident and one more reason why 5 Ghz wifi is preferred these days.
However, there are hardware limitations. For example, cheap wifi routers might pass that stick around much slower, so they may only be able to handle a handfull of devices before they start to get bogged down. Another clever trick with enterprise wifi setups, like the ones found in hospitals or hotels, is that you might have one wifi network, but multiple access points operating on different frequencies to connect to it. Each access point has it’s own talking stick, but connects to the same network either through a wired connection, or by talking to other access points on another frequency that’s reserved for access points only. This not only allows you to connect hundreds of devices to the same network, but it also allows you to extend that network over a wide area and balance the load across multiple access points.
They do but IT guys and Router Software is constantly fighting to manage that.
Old WiFi and new WiFi (6+) approach it differently.
Old WiFi is like hundreds of people trying to speak up on a conference call. You just start talking and if you accidentally talk over someone else you stop wait a random amount of time and try to talk again and hope they don’t pick the same random delay to start walking.
New Wifi it explicitly schedules everybody and you get a speaking schedule for how long you can talk. If you want to talk you need to request a speaking slot and it’ll be assigned to you. This is obviously way more efficient.
Both old and new also assign different channels. So it’s like being assigned a different walkie talkie channel.
Since old and new WiFi aren’t backward compatible obviously if you have a single old WiFi device on a channel that means it’ll have to revert to just randomly trying and waiting. Hence why you want everyone nearby in an apartment building to upgrade.
They do interfere with each other. That’s why it gets slower. Basically if I want to send a bit of information, the way it works is I send and I listen at the same time. If no one else is transmitting at that moment, what I hear should be what I sent, and we’re good. If someone else is transmitting at the same time (the odds of which increase as there are more people using it), I’ll hear something other than what I sent. Not good, it means I need to send again. The way it works is that, basically, I wait a random amount of time before trying to send again. So the need for me to resend in the first place,and the need for me to wait before doing it slows me down.