[PATCH] /proc/loadavg: add running/total processes

Corinna Vinschen corinna-cygwin@cygwin.com
Wed Mar 30 10:28:00 GMT 2011

On Mar 30 03:54, Yaakov (Cygwin/X) wrote:
> On Wed, 2011-03-30 at 10:13 +0200, Corinna Vinschen wrote:
> > On Mar 29 19:32, Yaakov (Cygwin/X) wrote:
> > > This patch adds the fourth component of Linux's /proc/loadavg[1], the
> > > current running/total processes count.  My only question is if states
> > > other than 'O' and 'R' should be considered "running" for this purpose.
> > 
> > That looks right.  But I don't see that get_process_state will ever
> > generate an 'O'.
> Good point.  get_process_state() returns only R/S/Z, but
> format_process_status() has a case for a few other states.  Why?

Dunno.  The code has been contributed by Christopher January in 2002
and is essentially unchanged since then.  I don't think anybody would
be angry with you if you're going to pick it up and dust it off a bit...

> > What about the last column in /proc/loadavg, the last pid?  Shouldn't
> > this be added and set to 0 as well?
> I don't think using a 0 is a good idea, in case some software scanf()s
> this file and tries to do something with the information (division by
> zero comes to mind).
> As for actually implementing the fifth column, I wasn't sure as to the
> true significance of this number: is it really just the pid of the last
> process or the number of processes launched since startup?  On Linux,
> AFAICS these are one and the same, as pids are allocated sequentially,
> but not on Cygwin.  I know the wording implies the former but the
> purpose of this file makes me suspect the latter.  Insight, anyone?

Not me.  I only know what the URL you sent is saying.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

More information about the Cygwin-patches mailing list