r/C_Programming • • Sep 01 '26

Question How process ids are generated

i know fork creates processes but how process ids are generated

6 Upvotes

22 comments sorted by

View all comments

Show parent comment

7

u/Axman6 Sep 01 '26

This isn’t true at all, we’ve had systems for generating cryptographically secure random numbers for decades. See FreeBSD’s Fortuna paper for one reference, and hardware random number generation like RDRAND, which can feed into systems like Fortuna as a source of entropy, along with IO system information which is generally unpredictable. 

-15

u/[deleted] Sep 01 '26

Process ids are generated sequentially 

10

u/Axman6 Sep 01 '26

Not on all OS’s.

5

u/Paul_Pedant Sep 01 '26

... apart from the bit where the OS has cycled round at least once, and needs to know that some of the pids are still referencing running processes. And the ones that are defunct but still not notified to their parent.