Messages in this thread | | | From | Bryan Donlan <> | Date | Wed, 4 Nov 2009 00:36:48 -0500 | Subject | Re: why kernel implement "udelay" by cpu instructions? |
| |
On Wed, Nov 4, 2009 at 12:01 AM, Rajat Jain <Rajat.Jain@infogain.com> wrote: > Hi, > >> I find something interesting; kernel has msleep, but it >> doesn't have usleep. >> Does that mean the minimum time kernel can react is msecond >> instead of usecond? >> so if users want to count useconds, they have to do the busy waiting, >> execute some looping assembly instructions? > > You are roughly right. If you don't want to busy loop (udelay / mdelay), then you will have to sleep. The granularity of this sleep depends on how frequently the timer interrupt ticks (HZ). Thus if HZ is 1000, then you cannot sleep for a period less than 1 msec.
I thought hrtimers allow higher-precision wakeups these days? Of course, if you only want to sleep for a few microseconds, the context switch might take longer than you want to sleep... -- 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/
| |