public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Damien TOURAINE <damien.touraine@limsi.fr>
To: landley@webofficenow.com
Cc: "Richard B. Johnson" <root@chaos.analogic.com>,
	linux-kernel@vger.kernel.org
Subject: Re: Call to the scheduler...
Date: Wed, 25 Jul 2001 13:03:27 +0200	[thread overview]
Message-ID: <3B5EA77F.5060200@limsi.fr> (raw)
In-Reply-To: <Pine.LNX.3.95.1010724134717.32263A-100000@chaos.analogic.com> <01072415121901.00631@localhost.localdomain>

Rob Landley wrote:

>On Tuesday 24 July 2001 13:54, Richard B. Johnson wrote:
>
>>Try sched_yield(). Accounting may still be messed up so the process
>>may be 'charged' for CPU time that it gave up. Also, usleep(n) works
>>very well with accounting working.
>>
>>This works, does not seem to load the system, but `top` shows
>>99+ CPU time usage:
>>
>>main()
>>{
>>    for(;;) sched_yield();
>>
>>}
>>
>This may not be an accounting problem.  If the system has nothing else to do, 
>it'll just re-schedule your yielding thread.
>
>How much of that 99% cpu usage is user and how much of it is system?  
>Basically what the above does is beat the scheduler to death...
>
In my case, as the process/thread that call the "sched_yield();" 
function "actively" waits for another process/thread finish its job, the 
process won't be the only one in the queue of activ job ...
Then, it won't use 99% of the time ...

>>This works and `top` shows nothing being used:
>>
>>main()
>>{
>>
>>    for(;;) usleep(1);
>>
>>}
>>
>And here you DO block for a bit without getting called back immediately.
>
However, I would like to know the scheduler frequency to switch between 
tasks.
If it's above 1 us, the usleep don't match my requirements ...

However, thanks for your quick and pertinent answer !

Friendly
    Damien TOURAINE



      reply	other threads:[~2001-07-25 10:56 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-07-24 17:32 Call to the scheduler Damien TOURAINE
2001-07-24 17:54 ` Richard B. Johnson
2001-07-24 19:12   ` Rob Landley
2001-07-25 11:03     ` Damien TOURAINE [this message]

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=3B5EA77F.5060200@limsi.fr \
    --to=damien.touraine@limsi.fr \
    --cc=landley@webofficenow.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    /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