lkml.org 
[lkml]   [2001]   [Apr]   [5]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: how to let all others run
From
Date
"Richard B. Johnson" <root@chaos.analogic.com> writes:

> On 4 Apr 2001, John Fremlin wrote:
> >
> > Hi Oliver!
> >
> > Oliver Neukum <Oliver.Neukum@lrz.uni-muenchen.de> writes:
> >
> > > is there a way to let all other runable tasks run until they block
> > > or return to user space, before the task wishing to do so is run
> > > again ?
> >
> > Are you trying to do this in kernel or something? From userspace you
> > can use nice(2) then sched_yield(2), though I don't know if the linux
> > implementations will guarrantee anything.
> >
>
> I recommend using usleep(0) instead of sched_yield(). Last time I
> checked, sched_yield() seemed to spin and eat CPU cycles, usleep(0)
> always gives up the CPU.

What is wrong with this? sched_yield only yields to processes with
lower priority (hence suggestion to use nice(2)). Does sched_yield()
fail to yield in cases when a higher priority process wants to run?
usleep() wastes time if no other such process is waiting, surely?

[...]

--

http://www.penguinpowered.com/~vii
-
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/

\
 
 \ /
  Last update: 2005-03-22 13:24    [W:1.279 / U:0.120 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site