Re: why kernel implement "udelay" by cpu instructions?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 4, 2009 at 12:01 AM, Rajat Jain <Rajat.Jain@xxxxxxxxxxxx> 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 an email with
"unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx
Please read the FAQ at http://kernelnewbies.org/FAQ



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux