102 ms·
Not OP, but one good reason to do that is to reduce probability and frequency of collision with other periodically running jobs. Let's say you run your job on
by dimtion 6y ago
Not OP, but one good reason to do that is to reduce probability and frequency of collision with other periodically running jobs.
Let's say you run your job on the hour, and you have a job running every 4h and another every 24h, without planning, because 4 divides 24, you have one in four chance of having them collide and having the 24h job running at the same time than the 4h job.
If you add more 4h jobs, the probability that one of those 4h jobs collide each time with the 24h job increases.
The more jobs you have, the higher the probability that some will be divisors of others.
Using prime number for scheduling reduce the probability at a given time that those jobs collides. If you create a job every 5h and another every 23h, the 23h will collide with the 5h job every 115h. PPCM(5, 23) = 115.
Interestingly, this technique is used in nature by cicadas who developed long, prime-numbered, periodical life cycles to avoid gaining a predator that can sync up with the cicadas[0].
[0] https://www.cicadamania.com/cicadas/cicadas-and-prime-numbers/ https://www.cicadamania.com/cicadas/cicadas-and-prime-number...
- MayeulC 6y agoAnd the number of teeth on two interacting gears is usually coprime, to distribute wear more evenly.