Re: Call to the scheduler...

From: Rob Landley (landley@webofficenow.com)
Date: Tue Jul 24 2001 - 14:12:19 EST


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

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

I don't think that's an accounting thing, I think it's different behavior.
(Could be wrong, as always...)

>
> Cheers,
> Dick Johnson

Rob
-
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/



This archive was generated by hypermail 2b29 : Tue Jul 31 2001 - 21:00:21 EST