public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Jos Hulzink <josh@stack.nl>
To: Anu <avaidya@unity.ncsu.edu>, LKML <linux-kernel@vger.kernel.org>
Subject: Re: an idling kernel
Date: Sat, 2 Nov 2002 23:16:31 +0100	[thread overview]
Message-ID: <200211022316.31977.josh@stack.nl> (raw)
In-Reply-To: <Pine.GSO.4.44.0211021518290.6197-100000@sun.cesr.ncsu.edu>

Hi,

Well.. this mailing list is not that bad for questions like this. You got the 
idea somewhat right though it is implemented quite different. The big word 
here is scheduling. A scheduler is a piece of code that determines what 
thread is to be executed next. How this is done is something entire books are 
written about, and a topic that will be discussed on the lkml often.

With linux, the idle thread is entered when the scheduler finds no threads 
ready for executing. (Not only sleeping, but also waiting for Disk etc) With 
some BSD clones, there is something of an idle queue, a list of threads that 
is only to be executed when the system is actually idle. When the scheduler 
access this queue, you know it has nothing important to do anymore. Linux 
uses priority queueing (see the nice manual for info on that). But, for both 
solutions holds: as soon as the scheduler reaches the end of the queue(Linux) 
/ queues (some BSDs) without finding a thread that can be executed, the 
scheduler enters the real idle thread.

In short: you don't really have to count. You only have to check if you reach 
the end of your thread list. Checking if a thread is able to run is what your 
scheduler already does.

See the scheduler code for more info.

Jos


On Saturday 02 November 2002 21:37, Anu wrote:
> disclaimer: if this is the wrong ng to be posting this to, its only due to
> ignorance.. I dont know the first thing about where to post this
> question..
>
> ----------------------------------------------------------------------
>
> Hello,
> 	Im ready to be beaten up for asking this question ( I am not sure
> which group to post to -- all this is new to me) but, I was wondering how
> one could figure out if the kernel was in idle mode (or idling).
>
> I *have* tried to look for the answer and here is waht I have come up with
> so far :
>
> Process 0 is the idle process.. but, I dont understand how you can tell if
> this means that the kernel is in idle mode. Do we just probe the state
> field of all process entries and check to see if everyone is sleeping and
> conclude that the kernel is idling??
>
> for_each_process(p)
>  {
>     if(process->state == S)
>      {
>         countup;
>      }
>  }
>
> if countup == number of processes, then the kernel was idling?
>
>
> -anu
>
> ***************************************************************************
>*****
>
> 			     Think, Train, Be
>
> ***************************************************************************
>****
>
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at  http://www.tux.org/lkml/



  reply	other threads:[~2002-11-02 21:10 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-11-02  8:13 [BK PATCHES] initramfs merge, part 1 of N Jeff Garzik
2002-11-02  8:18 ` Jeff Garzik
2002-11-02  8:42 ` Aaron Lehmann
2002-11-02  8:46   ` Jeff Garzik
2002-11-02  8:50     ` H. Peter Anvin
2002-11-02 19:01   ` Linus Torvalds
2002-11-02 12:07     ` H. Peter Anvin
2002-11-02 20:24     ` Alexander Viro
2002-11-02 23:46     ` Dave Cinege
2002-11-02 10:51 ` miltonm
2002-11-02 17:12 ` Matt Porter
2002-11-02 12:14   ` H. Peter Anvin
2002-11-02 20:37     ` an idling kernel Anu
2002-11-02 22:16       ` Jos Hulzink [this message]
2002-11-03  0:43       ` identifying the idling kernel and kernel hacking Anu
2002-11-04 19:16       ` an idling kernel Werner Almesberger
2002-11-02 20:37     ` [BK PATCHES] initramfs merge, part 1 of N Alexander Viro
2002-11-02 23:36     ` Matt Porter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=200211022316.31977.josh@stack.nl \
    --to=josh@stack.nl \
    --cc=avaidya@unity.ncsu.edu \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox