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

3

u/Key_River7180 Sep 03 '26

The os keeps track of the highest process ID assigned, when you make a process It just gets you the highest id + 1 and increases the counter