public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* sched_yield() version 2.4.24
@ 2004-03-30 16:47 Richard B. Johnson
  2004-03-30 16:58 ` Chris Friesen
  0 siblings, 1 reply; 10+ messages in thread
From: Richard B. Johnson @ 2004-03-30 16:47 UTC (permalink / raw)
  To: Linux kernel


Anybody know why a task that does:

		for(;;)
		   sched_yield();

Shows 100% CPU utiliization when there are other tasks that
are actually getting the CPU?  It seems that a caller to
sched_yield() does not show that it is sleeping for any
portion of the time it gives up the CPU. On the other hand,
if usleep(0) is substituted, the task is shown to be sleeping.

This shows that the accounting for sched_yield() is mucked
up. It works fine, it gives up the CPU to other tasks. However,
`top` shows it as a CPU hog, which it isn't.

Simple code to check it out:

extern void sched_yield(void);
extern int usleep(int);
int main()
{
#if BAD
    for(;;)
        sched_yield();
#endif
    for(;;)
        usleep(0);
}

Cheers,
Dick Johnson
Penguin : Linux version 2.4.24 on an i686 machine (797.90 BogoMips).
            Note 96.31% of all statistics are fiction.



^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2004-04-02 19:43 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-30 16:47 sched_yield() version 2.4.24 Richard B. Johnson
2004-03-30 16:58 ` Chris Friesen
2004-03-30 17:09   ` Richard B. Johnson
2004-03-30 17:30     ` Chris Friesen
2004-03-30 17:52       ` Ben Greear
2004-03-30 19:40         ` Denis Vlasenko
2004-03-30 20:29           ` Richard B. Johnson
2004-03-30 23:10             ` Diego Calleja García
2004-03-31 13:53             ` Richard B. Johnson
2004-04-01  0:05               ` Eric W. Biederman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox