[lkml]   [2002]   [Feb]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: schedule()
On Tue, 26 Feb 2002, Jeff Garzik wrote:
> "Richard B. Johnson" wrote:
> >
> > I just read on this list that:
> >
> > while(something)
> > {
> > current->policy |= SCHED_YIELD;
> > schedule();
> > }
> >
> > Will no longer be allowed in a kernel module! If this is true, how
> > do I loop, waiting for a bit in a port, without wasting CPU time?
> Call yield() or better yet, schedule_timeout()

Yes, please use schedule_timeout() if at all possible, or make sure that
the loop will only ever execute for a few 100us at most.

One thing to bear in mind is that using yield() will waste CPU time if
the code is ever called by a real-time process (unless it is a SCHED_RR
process with other runnable SCHED_RR processes at the same priority),
because there will be no other process that the scheduler is allowed to
run, so the RT process will just be chosen to run again, with no delay.

We really need high resolution timers, so that schedule_timeout() can be
used for delays of less than one jiffy.

Nigel Gamble
Mountain View, CA, USA.

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

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