Subject: Re: microtime
To: Gary Thorpe <gat7634@hotmail.com>
From: Andrew Brown <atatat@atatdot.net>
List: tech-kern
Date: 08/02/2002 13:56:27
>I have another time-related question: for very short times one should use 
>DELAY() (or delay()), but when is it "long enough" to use something like 
>tsleep()? When is the overhead enough to justify sleeping instead of polling 
>using delays?

most ports #define DELAY() in terms of delay(), although the algor
(and the arc, and...hmm...all the mipsel ports, it seems) does it the
other way around.  delay delays.  iirc, while you are delaying,
nothing else is allowed to happen, except for interrupt handlers for
interrupts that haven't been masked.  processes don't run, your mouse
doesn't move, etc.

tsleep() is for contexts where you have a process that can block.  the
cpu will then switch to a different process.  other stuff is allowed
to happen.

it's not a matter of "how long".  mostly it's a matter of the context
you're in.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."