Re: Call to the scheduler...

Rob Landley (landley@webofficenow.com)
Tue, 24 Jul 2001 15:12:19 -0400


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/