Re: What are the different timer that exists in the kernel?

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

 



Peter Teoh wrote:
Just purely based on symbol search, I can see these different timer in
the system:

c01124ab t create_pit_timer
c0158d7c T posix_cpu_timer_create
c0158e7d t process_cpu_timer_create
c01569c9 T sys_timer_create
c01575e8 W sys_timerfd_create
c0158e67 t thread_cpu_timer_create


a.   what are the differences among these different timer?

I think the underlying hardware timer used by most of the functions you mention is actually the same. The only real differences are the interfaces exposing how you program events on it.

I believe resolution and how you can use the timers is the main difference between posix and timerfd calls. For example the API for posix timers is pretty much set in stone so if you want to expose a timer with different properties you will need a different call. According to http://lwn.net/Articles/245533/ and http://kernelnewbies.org/Linux_2_6_25#head-ae00db3cc69df29b62a33d6993adb5102b228fa7 timerfd came about because it eliminates the need for signal based timers (you get a file descriptor with your timer back) and additionally you can find out how many times your timer has fired if you have missed it a few times.

There are also different hardware timer devices. These have different properties and may not be available (HPET is high resolution but is not available in older machines, TSC tends to give unreliable results on machines that can do frequency scaling, PIT is slow to access etc.) - there seems to be comparison of them on http://evuraan.blogspot.com/2007_07_01_archive.html . Another example is that you can't do dynticks/nohz unless you also have high resolution timers.

Both thread_cpu... and process_cpu... call posix_cpu_timer_create underneath so I don't really see that there is a difference between them (other than the timer's "type"). posix_cpu_timer_create is also called when the system has to do_cpu_nanosleep .

c.   since the hardware clock source is only a few possibility, what
their individual hardware infrastructure based on?   ie, all these
have ONE single hardware clock source?   WHY NOT? (resolution
differences?)

I don't really understand this question. Underneath these are (probably) all being driven by the same clock hardware. The only difference is that some interfaces expose more features or always set a particular type for the timer event.


--
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