2

As the title suggests, what happens when pid_max (32bit standard is 32768) is reached with many zombie-processes?

On our server a user generates a lot of suphp defunct zombie processes and this forces our server to restart... and I think this happens because the pid_max is reached...

I'm running CentOS 5.8 with Apache 2.2.3

Thanks. Best regards, John.

EDIT Thanks for the answers.

3
  • 1
    It's not clear what you mean. Are you asking what happens when you have 32,768 processes? Or are you asking what happens when you have a process with the highest possible PID? Mar 20, 2013 at 11:03
  • yes, i wanted to know what happens when 32,768 processes are running and a new process wants to start! Mar 20, 2013 at 11:55
  • Please read our tour page so you can understand better how our Q&A site works.
    – user9517
    Mar 20, 2013 at 12:04

3 Answers 3

4

PIDs are generated sequentially and before being assigned to a process a check is made to ensure a process doesn't currently have a particular PID. When pid_max is reached the counter simply wraps back to the beginning. If there are no more PIDs available then no more proceses can be created and you'll get an error message "...No more processes."

3
  • thanks for the answer. sounds clear. maybe you have an answer for my modified question too? Mar 20, 2013 at 11:59
  • @JohnBrunner: This isn't how SE & SF work. You ask a question and get answers. If you asked the wrong question, then you should ask a new question and if necessary refer to the earlier one. If answers are useful you should upvote them and consider accepting one.
    – user9517
    Mar 20, 2013 at 12:03
  • allright. i will start a new question. thanks for the help! Mar 20, 2013 at 12:25
2

If there are no available PIDs, then new processes cannot be created. Some operating systems reserve a few PIDs for the root user.

PIDs are re-used though. So if there's an available PID, it will be used.

1
  • thanks for the answer. sounds clear. maybe you have an answer for my modified question too? Mar 20, 2013 at 11:58
0

The Linux Programming Interface covers this, and I will just quote it here cause it is a little bit more specific than the accepted answer. From page 115.

On a 32-bit system, the maximum PID is 32767. Each time the limit is reached, the kernel resets its process ID counter so that process IDs are assigned starting from low integer values.

And it will be reset to 300, rather than 1. This is done because many low-numbered process IDs are in permanent use by system processes and daemons, and thus time would be wasted searching for an unused process ID in this range.

I am not sure that the default reset value is still 300 on 64 bits systems, maybe the number of system processes just increases in a 64 bits kernel?

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .