Re: [patch 00/43] ktimer reworked

From: Steven Rostedt
Date: Thu Dec 01 2005 - 21:21:56 EST


On Fri, 2005-12-02 at 01:02 +0100, Thomas Gleixner wrote:
> On Thu, 2005-12-01 at 22:15 +0000, Christoph Hellwig wrote:
> > On Thu, Dec 01, 2005 at 05:13:17PM -0500, Kyle Moffett wrote:
> > > In this patch there are two ways of setting up code to run at some
> > > point in the future: timers and timeouts.
> > >
> > > A timeout (like waiting for somebody to answer the phone) is
> > > optimized to never happen (they will hopefully pick up first). If
> > > everything works perfectly; it will be stopped before it has a chance
> > > to go off.
> > >
> > > A timer (like a kitchen timer telling you the cookies are done) is
> > > optimized to be added and sit around until it expires. You just
> > > don't turn off the timer and take the cookies out before they are done.
> >
> > Heh, in my dumb non-native speaker mind I'd expectit the other way around,
> > as in a timeout is expected to time out :) and a timer is expect to happen,
> > as in say the timer the tells you your breakfast egg is ready.
>
> Which is perfectly the point Kyle made.
>
> The timer tells you that the cookies or your breakfast eggs are well
> done. You put them out of the oven or the pot at exactly the time when
> the timer event happens. You won't turn off the timer before your
> cookies/eggs are done, because you want them well done.

As I mentioned before, this is where you expect an event to happen (I
want x to happen at some time). The event being to take out the
cookies.

>
> The timeout you set up is to remind you to switch off the oven before
> your kitchen starts to burn. This timeout is likely - not sure in your
> personal case :) - to be cancelled because you did think about switching
> off the oven in time. If you forgot it, it is not a big difference if
> you get the reminder 5 minutes earlier or later.

And this is where a time out is done when some event doesn't happen (I
want to know if x didn't happen by some time). The event here is to
turn off the oven and the time out is to let you know that you didn't
and the house will soon burn down if you don't turn it off.

> In case of the egg / cookie timer the distcintion of 1 to 5 minutes
> makes a big difference.


I started kernel programming with writing experimental network stacks.
So to me "timeout" is strongly engraved in my head as to let you know
when something didn't happen, and you need to do something to recover
for it. If you send out a packet and you don't receive an ACK, you have
a timeout let you know that it probably didn't make it (or the ACK
didn't make it to you), and send another packet out. But most likely,
(unless you are on a really unreliable network) you get your ACK and you
can remove the time out.

I know that timeouts are used tremendously in the networking code, so
separating them from precision timers would likely be a good thing.

-- Steve


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/