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 12:27 +0200, Corinna Vinschen wrote:
> 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...

That's alright, I think I'll leave that alone for now; I have other
patches waiting in my queue to deal with.

Bottom line: should I remove the case 'O' since get_process_state
doesn't (yet?) return it, or leave it in as in format_process_status()?

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

Then I would like to leave the fifth column for a later time.


Yaakov



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