# What is the correct CSMA p-persistent algorithm?

After reading some books and sources I understand that the CSMA p-persistent protocol works like this:

• if the channel is idle, it transmits with probability `p`, and with probability `1 - p` it defers to the next slot; if that slot is also idle, it repeats this step;
• if the channel is busy, it waits until the channel is idle, and then applies the above step.

Just to mention one of the many sources: Computers Network (A. Tanenbaum, 5th edition) provides the above algorithm at page 267.

But this doesn't sound right to me. If the chosen value of `p` is 0, it means that the algorithm is going to defer the transmission with a probability of 1, always. So it will always defer and never transmit anything.

Also, if the channel is initially found idle, why should the algorithm wait? Isn't that an useless waste of resources?

So is this considered the correct algorithm? Shouldn't it be changed to wait only once with a probability of `1 - p` and then send? Otherwise the transmission could be deferred a possibly infinite number of times.

• Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer. Feb 21, 2018 at 18:21
• I'm actually still waiting for an answer, as the current one seems to be an opinion more than a well-documented answer. If it's a problem I can accept that answer, but it didn't help much Feb 21, 2018 at 18:50
• You do not need to accept an answer that is not what you are looking for. We are simply trying to clean things up with a friendly reminder because some people forget or don't know. You could comment on the answer and ask for backup of what you consider an opinion. Feb 21, 2018 at 18:58
• I actually asked for a source, but he didn't have one, unfortunately Feb 21, 2018 at 19:33

A probability of 0 doesn't make sense unless you don't want to transfer ever. You need to choose something between 0 and 1.

The algorithm waiting for the start of the slot time reduces the chance that someone else has just started transmitting but the carrier hasn't reached you yet. Overall, it increases the effiency of CSMA by reducing the penalty of a collision.

Not using the first possible slot but working with a probability is way to get a fairer distribution of traffic. It greatly reduces the possibility for a busy sender to hog the medium.

The `1-p` probability for the skipping the first slot just expresses that you either send now (probability p) or on the very next slot (probability 1-p). You don't throw the dice for each slot again and again.

• Thank you, but I still don't get it. You say that "you don't throw the dice for each slot again and again", but that's exactly what the algorithm appears to be saying, that for each slot you transmit with probability `p` and defer with probability `1-p`, and repeat. Also, if it's true that the slot is skipped just once as you say, the 0-persistence algorithm would actually make sense, because you defer only once and then transmit. Jan 2, 2018 at 21:24
• As far as I remember, you only throw the dice once for each packet you want to transmit and not repeatedly for a single packet.
– Zac67
Jan 2, 2018 at 21:49
• Do you have a reliable source for that, perhaps? Thanks. Jan 3, 2018 at 11:05
• No sorry, I'm not that much into MA any more. Have you checked 802.3 clause 4.2 for a real-world implementation? MA for 802.11 is much more complicated as it mixes various mechanisms.
– Zac67
Jan 3, 2018 at 12:32