MAC protocol simulator
A bunch of stations want to talk on one shared radio channel. Only one transmission can be heard cleanly at a time — if two start at once, both get garbled. Pick a rule for when a station may talk, then watch what happens.
How to use
- Pick a protocol (one of the four buttons).
- Press Play. Watch the timeline scroll. Green blocks are successful transmissions, red blocks are collisions.
- Drag the offered load slider up. Notice how every protocol breaks down differently as the channel gets busy.
- Look at Throughput vs offered load at the bottom — the dot is your current run, the dashed curves are the textbook predictions.
Protocol
Knobs
Channel timeline
Live counters
Throughput vs offered load
Things to try
- Start with Pure ALOHA. Set load to 0.5 — this is the theoretical sweet spot. Note the throughput ≈
1/(2e) ≈ 0.18. - Push the load to 2.0. Watch the channel saturate with collisions; throughput collapses. This is the famous ALOHA instability.
- Switch to Slotted ALOHA at the same load. Throughput roughly doubles — lining transmissions up to slot boundaries removes half the vulnerable window.
- Switch to CSMA + random backoff. Stations now listen before talking. Most collisions vanish; throughput stays high even at heavy load.
- Switch to p-persistent CSMA at heavy load (load = 2.0, 16 stations). With p = 1.0, all the queued stations stampede the moment the channel goes quiet and collide. Drop p to 0.1: stations spread their attempts out, collisions plummet, and throughput jumps above 0.5. The cost is each individual station has to wait a bit longer for its turn — latency vs. throughput trade-off.
What the simulator is actually doing
Time is discretised into mini-slots. One frame takes 4 mini-slots to transmit. Each station independently generates packets as a Poisson process; the slider sets the aggregate arrival rate G in in frames per frame-time, which is then split equally across stations.
A "collision" means two transmissions overlap on the channel for any portion of their frames — both are marked failed and both stations retry after a random backoff. Successes and attempts are counted in frames; S and G are those counts converted to frame-time units, so a value of 1.0 means the channel is fully utilised.
Pure ALOHA: transmit on arrival. Slotted ALOHA: defer arrivals to the next frame-aligned slot boundary. CSMA: at every mini-slot, if the channel is idle, transmit (1-persistent). p-CSMA: at every idle mini-slot, flip a biased coin with probability p first. Carrier sensing here is idealised — zero propagation delay — so CSMA collisions only happen when two stations decide to start in the same idle mini-slot.