Re: Call to the scheduler...

From: Damien TOURAINE (damien.touraine@limsi.fr)
Date: Wed Jul 25 2001 - 06:03:27 EST


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

-
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:22 EST