On Fri, 16 Aug 2013 12:57:23 -0400, Rik van Riel said: > On 08/16/2013 09:20 AM, emani murali wrote: > > Hi, > > > > I'm trying to obtain number of runnable processes from linux kernel. sar > > -q gives this information readily. However I'm trying to get this value > > from /proc filesystem. There is no file in /proc that gives this value > > directly, then how is runq-sz computed. > > Tools like top, vmstat, and sar, simply look at all the processes > in /proc, and count the number that are in runnable (R) state. Which is why I asked what Emani is trying to do - scanning /proc is inherently racy, and the runq-sz value can change and/or be different than counting the number of runnable processes. A slight bit of jitter in the output of top probably doesn't matter. Feeding the number back into a scheduler loop or something like that may matter a lot...
Attachment:
pgp_ErFhH9BjI.pgp
Description: PGP signature
_______________________________________________ Kernelnewbies mailing list Kernelnewbies@xxxxxxxxxxxxxxxxx http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies