lkml.org 
[lkml]   [2009]   [Nov]   [4]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: 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/

\
 
 \ /
  Last update: 2009-11-04 06:39    [W:0.036 / U:0.148 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site