Re: Q: waiting for a short time and not beeing a resource hog

Andreas Schuldei (schuldei@andrive.de)
Wed, 1 Dec 1999 15:09:43 +0100


Quoting Jens Axboe (axboe@image.dk):
> On Wed, Dec 01 1999, Andreas Schuldei wrote:
> > I do not like the
> > while( (jiffies-time_start) < 1 );
> > since it is too long and blocks the whole cpu from doing sensible stuff.
> > static void jiffy_sleep(u_int time)
> > current->state = TASK_INTERRUPTIBLE;
> > current->timeout = jiffies + time;
> > schedule();
> > Is this still applicable and racecondition-save?
> Not in an interrupt context. Basically you can't sleep or
> schedule inside an interrupt handler. How long do you need
> to wait?

for 50 us (10000 ticks on a 200MHz machine).

Is
schedule_timeout(ticks)

any better? I see it beeing used quite a lot in nowerdays kernels

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/