Find the answer to your Linux question:
Results 1 to 8 of 8
Anyone knows? Than you....
  1. #1
    Just Joined!
    Join Date
    Mar 2010
    Posts
    12

    Which can be the biggest PID number?

    Anyone knows?
    Than you.

  2. #2
    Linux Engineer GNU-Fan's Avatar
    Join Date
    Mar 2008
    Posts
    935
    /proc/sys/kernel/pid_max
    Debian GNU/Linux -- You know you want it.

  3. #3
    Linux Enthusiast Kloschüssel's Avatar
    Join Date
    Oct 2005
    Location
    Italy
    Posts
    717
    Depends on:

    1] architecture (32bit, 64bit)
    2] for *nix also on the configuration at /proc/sys/kernel/pid_max
    3] hardware limitation (memory, cpu power, ..)

    theoretical limits are:
    * unsure, but I think something like 2^7 for 16bit system
    * 2^15 for 32bit system
    * unsure, but I think something like 2^31 for 64bit system
    * programs written against old-style SysV IPC interface and are linked against pre-2.2 glibcs will be broken if the pid is too high (as there were only small pid numbers for 16bit systems or so supported)

    all information without warranty. as there are plenty of factors that may change from one distri to another (not to say from solaris over to mac or other *nix distris like debian) look at the man pages of your system for accurate information.

    oh, i forgot a last sidenote: I recall values above 2^16 ~ 64k make not much sense as todays cpu's will most likely get cranky when they need to context switch between this much processes. if every little process does something, all processes literally die of starvation while waiting for their turn riding on the cpu cycle.
    Last edited by Kloschüssel; 07-21-2010 at 12:35 PM.

  4. #4
    Just Joined!
    Join Date
    Mar 2010
    Posts
    12
    Quote Originally Posted by Kloschüssel View Post
    Depends on:

    1] architecture (32bit, 64bit)
    2] for *nix also on the configuration at /proc/sys/kernel/pid_max
    3] hardware limitation (memory, cpu power, ..)

    theoretical limits are:
    * unsure, but I think something like 2^6 for 16bit system
    * 2^22 for 32bit system
    * unsure, but I think something like 2^64 for 64bit system
    * programs written against old-style SysV IPC interface and are linked against pre-2.2 glibcs will be broken
    Thanks you.

  5. #5
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    The system variable type pid_t is usually an int, which would be a 32-bit value in either a 32-bit or 64-bit system. However, it is usually set to a small int ( 16-bit ) maximum value ( 32768 ). Once the system runs out of pids it will start reusing available ones. Normally this is a long enough period of time (computer-wise) that running processes will not be affected by that for whatever reason.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  6. #6
    Linux Newbie
    Join Date
    Mar 2010
    Posts
    121
    /proc/sys/kernel/pid_max and 32768 have both been mentioned - however, note that this is one more than the maximum allowable pid.

  7. #7
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, or in a galaxy far, far away.
    Posts
    8,974
    Not really. Remember, the pid is a 32-bit value, so it can be up to 2^31 (approximately) in theory. The limit is arbitrary, and likely due to how the kernel is configured (process table sizes, etc).
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  8. #8
    Linux Newbie
    Join Date
    Mar 2010
    Posts
    121
    Quote Originally Posted by Rubberman View Post
    Remember, the pid is a 32-bit value, so it can be up to 2^31 (approximately) in theory. The limit is arbitrary, and likely due to how the kernel is configured (process table sizes, etc).
    I don't think I get what you're saying. According to the documentation (i.e. proc(5)), that's what the contents of /proc/sys/kernel/pid_max are - the number at which the pid will wrap around at. Yes, this is arbitrary and yes, it could be bigger. There may even be a bug that means it sometimes is larger than that - but that's exactly what it would be, a bug. The specified behaviour is to wrap around so the number never hits (on my machine) 32768.

    Either way, it's likely the finer points of this don't really matter for OP's purposes, but I just thought I'd raise the point just in case.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
...