So, this question actually asks two question:
- how to find the optimal value of p
- given a value of p, how to set this value of p on any participating system
For the first question: I would say that the probability p is chosen "experimentally" through modelling and/or simulation.
Throughput is decreased by both too low and too high values of p. If p is low, the probability of several stations accession channel at the same time is reduced. However, is p is too low, it may result in no station actually sending => empty time slot => lower throughput. If p is high, stations are likely to transmit. However, the probability of several stations attempting to transmit is higher, thus probability of collision increases, which also decreases throughput.
Here are the references I could find:
- L. Kleinrock and F. Tobagi: "Packet Switching in Radio Channels: Part I - Carrier Sense Multiple-Access Modes and Their Throughput-Delay Characteristics", 1975 (pdf)
- H. Takagi and L. Kleinrock: "Throughput Analysis for Persistent CSMA Systems", 1985 (pdf)
I admit, not the simplest math.
Some text-books include chapters on throughput analysis of Slotted ALOHA, CSMA/CD, which i think are based on the first paper.
For the second question, it should be specified in a standard. Which gives us options.
- specify a value of p in a standard, then everyone can just hard-code it
- specify that p is a configuration parameter, which means that each system should be somehow configured with the value (i would say that this is bad protocol design)
- specify how stations can agree on the value of p. (example: in a context of wi-fi, one could specify that access point should tell stations their values of p).
- the value of p is not necessarily fixed. A common strategy for backoffs on subsequent retransmissions is to start with p=1 and then reduce p each time there is a collision. (wikipedia)
- value of p is not necessary the same for each system. there are situations when we want to give priority to some stations. In this case one could assign larger values of p for systems with higher priority. The only accessible reference that I could find is this PhD thesis. If you have university access to IEEE and ACM, googling something like this could help: "Throughput Analysis of a p-Persistent CSMA Protocol with QoS Differentiation"