On Sat, Nov 7, 2009 at 2:51 PM, Emanuel Rumpf <xbran(a)web.de> wrote:
Looks like HPET and RTC are hardware devices, where
HPET is meant
to be superior and replace the RTC.
correct, to a large extent.
I still don't get: What is the HR-timer ?
I mean how does it compare to the HPET ?
When to decide for the HPET, when for the HRT api ?
Does one if it depend on the other ?
Modern motherboads come with timers that are capable of massively
higher precision than older ones, and allow for very precise
scheduling of timer interrupts quite along time in advance of the
timer going off. The existence of this kind of capability can be used
to implement system scheduling in some moderately different ways.
HR-Timer is the name given to some kernel patches (now in the
mainstream kernel) that allowed the use of this timing hardware. The
changes were a mix of new code that deals with the new capabilities,
and patches that reimplement the existing system timer/scheduling
design using the new hardware.
So, HR-Timer (patches/code/design) requires a high res clock (like HPET).
Note that one of the possible ways to use the HR Time infrastructure
is to go totally tickless. In this design, the kernel is no longer
woken at fixed, regular intervals as has been the case for the entire
history of Linux. Instead, the kernel constantly adds new deadline
times which, when expired, generate an interrupt. In the very, very
unlikely case of there being only one process that is runnable, you
can it without any timer deadlines at all (until some other process
becomes runnable). Obviously, its rather complex, but also totally
awesome stuff. This is separate from HR-Timer, but relies upon it, and
it generally referred to as a "tickless kernel".
the HR-Timer infrastructure is a MUCH better basis for scheduling
MIDI. Even with RTC=10000 (10^4), you still don't have a clock that is
running in sync with the nominal MIDI data rate. with HR-Timer in
place, you can actually schedule the delivery of MIDI bytes precisely
on time ("wake me up in another 0.3msecs") and not rely on a
metronomic tick like RTC.