Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Whenever you write a program that prints its own process ID, I've always (without any exception) received numbers ranging in the tens of thousands. Never less, never higher.

I was just wondering, why is are the process ID #s so high? Are the ones below it all system-related processes?

And then when I run the program again, it prints out an ID that is several hundred above the previous execution... what happens between these two executions that come right after each other?

share|improve this question
4  
What operating systems are you asking about? I see many process IDs less than 1,000 on my Linux system, and all are under 10,000 on my Windows system. –  David Schwartz Sep 12 '11 at 23:51
1  
@David: Windows reuses pids. –  Paul Nathan Sep 13 '11 at 2:49
    
Is there a certain algorithm that governs the reuse of pids? I'm assuming this also means there is a maximum number of processes than can be run... –  Dark Templar Sep 13 '11 at 5:24
1  
@Paul: And so does Linux. –  grawity Sep 13 '11 at 7:45
    
@Dark: On Linux, PIDs wrap around at 32768 by default (adjustable through /proc/sys/kernel/pid_max, I think you can have full 4294967296 if you want) –  grawity Sep 13 '11 at 7:46
add comment

migrated from programmers.stackexchange.com Sep 13 '11 at 1:34

This question came from our site for professional programmers interested in conceptual questions about software development.

closed as not constructive by Linker3000, Nifle, random Sep 15 '11 at 2:38

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer

up vote 10 down vote accepted

what happens between these two executions that come right after each other?

Several hundred other processes get run.

You are not the only user.

share|improve this answer
add comment

Not the answer you're looking for? Browse other questions tagged or ask your own question.