Re: timeout value less than timer granularity

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

 



Daniel,

There was an earlier post that jiffies can be changed I have read the 
earlier too, never tried. I have also read that the impact is the 
interrupt handler and respective tasklets based on timer, etc start 
running more frequently thereby affecting the overall system performance.

There are processor and platform specific ways of getting more finer 
timer information including registers like the TSC(time stamp counter)

udelay, etc are typically implemented using tight loops or platform 
specific manner. For ppc, there is a ppc asm instruction and alternative in
__const_udelay() and udelay() in include/asm-ppc/delay.h

for i386, check the TSC and asm implementation called from
__delay() in arch/i386/lib/delay.c

Needless to say neither are approximations! :)

Another project worth a look is High Res POSIX timers
http://sourceforge.net/projects/high-res-timers/
The readme of the project is also a good intro
http://sourceforge.net/project/shownotes.php?group_id=20460&release_id=46217

Finally, it would help to read the timer chapter, "Flow of time" in the 
linux device drivers, ed 2 book at
http://www.xml.com/ldd/chapter/book/ch06.html

or even better buy that book, it is worth it.

Regards
Amit




Daniel Marian wrote:
> Hello Amit/All,
>    If the timer granularity cannot go below 10ms then how is the functionality of the nanosleep and usleep
> system calls in Linux implemented ?
> 
> Is it an approximate ?
> How do I know the clock ticks in a Linux box(i386) 
> Like /proc/cpuinfo etc.
> 
> Is the timer granularity in the kernel different?
> 
> I feel all the above are newbie questions sorry abt it
> 
> TIA
> kind regards,
> daniel marian.
> 
> 
>>Daniel,
>>
>>It probably won't work, that is the timeout will occur only at 10ms, 
>>that is per tick(timer interrupt)
>>
>>Amit
>>
>>
>>Daniel Marian wrote:
>>
>>>Hello,
>>>   The tick in Linux is 10ms.
>>>In my userspace program can I have a timeout value less than this granularity.
>>>
>>>Example a timeout value of 4 milliseconds.
>>>If this is possible, how is this taken care by the kernel ?
>>>
>>>thanks,
>>>daniel.
>>
>>
>>
> 


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           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