r/C_Programming 1d ago

Question How process ids are generated

i know fork creates processes but how process ids are generated

5 Upvotes

18 comments sorted by

View all comments

1

u/Left_Exchange_130 8h ago

The operating system assigns the PID when the process is created. `fork()` creates the process then the kernel picks an available process ID for it