[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3e8340490911032136x56696cc3u3b6f3b1e5d132324@mail.gmail.com>
Date: Wed, 4 Nov 2009 00:36:48 -0500
From: Bryan Donlan <bdonlan@...il.com>
To: Rajat Jain <Rajat.Jain@...ogain.com>
Cc: loody <miloody@...il.com>, Rik van Riel <riel@...hat.com>,
linux-kernel@...r.kernel.org,
Kernel Newbies <kernelnewbies@...linux.org>
Subject: Re: why kernel implement "udelay" by cpu instructions?
On Wed, Nov 4, 2009 at 12:01 AM, Rajat Jain <Rajat.Jain@...ogain.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@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists