LINUX.IE, website of the Irish Linux Users' Group
Tux rules!

   
Home
New Users
Articles
Download
Projects
Community
Vendors

  Print Version
Email to...
 
Archives:


planetILUG

Recent News

News Archive


Join the
ILUG
on FaceBook


Join the
ILUG
on LinkedIn


Join the
ILUG SETI
Group



















 
 :: Mailing Lists

[ILUG] Maximum value of a PID

[ILUG] Maximum value of a PID

Vincent Cunniffe vcunniff at arbgroup.com
Mon Mar 13 11:09:03 GMT 2000


Niall wrote:
> 
> On Sun, Mar 12, 2000 at 07:22:24PM +0000, Nick Hilliard wrote:
> > > I read in some post to comp.unix.programmer that the maximum pid
> > > is 30000, and that's a historical limit, going back to AT&T SysV.
> > > It'll probably need a kernel hacker to shed some light ...
> >
> > It's only a historic limit in the same sense that, for example, file names
> > are limited to 14 characters.  The limit died a long, long time ago.
> >
> > POSIX states that pid_t should be of type int, but most versions of unix
> > wrap pid's at either 32000 or eles 32767.  FreeBSD goes up to 99999 before
> > wrapping (for legibility), and there may be some other regional varieties.
> 
> As I mentioned, I just noticed the wraparound happening (and no, I didn't
> force it - it was pure happenstance) and I wondered how the next PID is
> chosen. I saw PID 32766 and then PID 413 in my file serial numbers. Now, the
> production of one of these files in itself uses up a few PIDs and this is on
> a web server. There was AFAIR 8 minutes between these two, so there could
> easily have been 400 processes in that time. But, I did what we're supposed
> to do - I read the source. I don't do that as often as I should before
> asking a question (there's such a lot of it :-) ) but in this case, I lucked
> out because it was in the first place I looked (kernel/fork.c) and it wraps
> to 300 - quite an arbitrary number, just chosen to be probably bigger than
> all startup daemons etc. Oh and I looked - it does wrap at 32768, but
> there's no such thing as a comment to indicate why this is so.

There was a discussion about this on linux-kernel recently : the skipping of
300 PID's after wrapping around is indeed intended to jump startup processes,
primarily for reasons of speed in finding a valid new PID.

The low end of the PID namespace can reasonably be expected to be densely 
populated with long-living processes, while a free PID can be found more
quickly in the higher reaches.

For an admin point of view, it also makes it easier to distinguish startup 
processes for later ones, but this is an accidental byproduct.

Regards,

Vin




More information about the ILUG mailing list
Read this without the formatting.
                                                                                                    

 

Hosted by HEAnet


Maintained by the ILUG website team. The aim of Linux.ie is to support and help commercial and private users of Linux in Ireland. You can display ILUG news in your own webpages, read backend information to find out how. Networking services kindly provided by HEAnet, server kindly donated by Dell. Linux is a trademark of Linus Torvalds, used with permission. No penguins were harmed in the production or maintenance of this highly praised website. Looking for the Indian Linux Users' Group? Try here. If you've read all this and aren't a lawyer: you should be!
RSS Version
Powered by Dell