Re: how to let all others run

Ion Badulescu (ionut@moisil.cs.columbia.edu)
Thu, 5 Apr 2001 15:29:54 -0700


On Thu, 5 Apr 2001 12:52:28 -0400 (EDT), Richard B. Johnson <root@chaos.analogic.com> wrote:

> Only an observation:
>
>
> main()
> {
> nice(19);
> for(;;)
> sched_yield();
> }
>
> does...
>
[...]
>
> It consumes 99.1 percent CPU, just spinning.

And, umm, what *exactly* would you expect it to do? It's the only process
consuming cpu, and sched_yield() certainly doesn't yield to the idle
task. So it's basically the same as a "for(;;);" program, except it
spends more time in kernel space and schedules faster when something
else needs the cpu.

It's 100% expected behavior.

Ion

-- 
  It is better to keep your mouth shut and be thought a fool,
            than to open it and remove all doubt.
-
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/