This is the mail archive of the cygwin-patches mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


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?

> 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?


Yaakov



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]