Re: [PATCH] i386: Selectable Frequency of the Timer Interrupt

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

 



On Thu, Jul 14, 2005 at 01:06:00PM -0700, Linus Torvalds wrote:
> On Thu, 14 Jul 2005, Russell King wrote:
> > Umm.  Except, according to your description of what it's supposed to
> > do, the above code can have an accumulating error.
> 
> No. It can have a local drift, but the point is, the error never gets 
> worse - it _stays_ local.
> 
> There's no point in polling twice in immediate succession just because a 
> sleep overslept. That's like a security guard testing each door twice for 
> being locked, just because he overslept one round. Pointless.

That depends what you're trying to achieve.  If you're trying to achieve
an average interval of 10ms over half a second, your solution won't get
that, whereas mine will.

> But what matters is that you don't let your local errors accumulate into 
> the big picture.

Precisely - it's all about "the big picture" and what the requirements
there are.  My requirements for "once every 10ms" may be different from
yours.

An example may be best.  You need to toggle an IO output at 50Hz for
half a second but you don't care at all about the duty cycle.  You
do care about it being as close as possible 50Hz, and not 40Hz
because for whatever reason it's taking you a hypothetical (*) 2ms
latency between timer expiry either time.

(* - yes, I know we don't like that word here... 8) but I'm trying
to make a point through exaggeration, so I'm covering my ass when
someone says "but 2ms is a bloody stupid latency!".)

-- 
Russell King
 Linux kernel    2.6 ARM Linux   - http://www.arm.linux.org.uk/
 maintainer of:  2.6 Serial core
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]
  Powered by Linux