[zeromq-dev] What's a tickless timer?

Apostolis Xekoukoulotakis xekoukou at gmail.com
Tue Feb 5 20:57:07 CET 2013


yes, you are right lol. What you say is use timers to point to a function
that will handle to wake the correct actor.

Wont it be a problem to create and destroy a timer for every actor that
want to use the lazy pattern?
I use a red black tree to store msgs and set the poll timeout to the
shortest delay. I guess it is the same.

2013/2/5 Pieter Hintjens <ph at imatix.com>

> This is pretty much the reactor pattern we use in CZMQ. You set-up
> timers and then handle them by e.g. sending messages.
>
> -Pieter
>
> On Tue, Feb 5, 2013 at 8:40 PM, Apostolis Xekoukoulotakis
> <xekoukou at gmail.com> wrote:
> > Those delayed msgs are used to wake up the actor.
> >
> >
> > 2013/2/5 Apostolis Xekoukoulotakis <xekoukou at gmail.com>
> >>
> >> Let me say one of my use cases that, i think cant be handled by timers.
> >> This is WIP.
> >>
> >> I have in each thread multiple actors. Each such actor might want to ask
> >> for a service (like a database).
> >> It sends a message and then work passes to other actors. Since there is
> a
> >> chance that the response from the service is lost,
> >> I want to use the lazy pirate pattern per actor. So what I did was add a
> >> tickless service with poll
> >>  that sends msgs to a socket (or directly to the same thread that has
> the
> >> poll ) after a specific delay.
> >>
> >> I think that having payloads on timers is a useful pattern in general.
> >>
> >> 2013/2/5 Pieter Hintjens <ph at imatix.com>
> >>>
> >>> On Tue, Feb 5, 2013 at 5:35 PM, Apostolis Xekoukoulotakis
> >>> <xekoukou at gmail.com> wrote:
> >>>
> >>> > If you have a timer to expire after 1m , you dont check every 20 ms
> if
> >>> > it
> >>> > expired, you use poll() that wakes after 1m if no other event
> happens.
> >>>
> >>> Right. The original goal is to reduce CPU wakeups, so tickless code
> >>> will work nicely on low power devices. The concept comes from the
> >>> Linux kernel: https://lesswatts.org/projects/tickless/
> >>>
> >>> As well as reducing CPU wakeups it makes it easier to schedule precise
> >>> events, e.g. send PING once per second, even if there was some other
> >>> activity in the meantime. You need this when you are doing anything
> >>> complex.
> >>>
> >>> zmq_poll should IMO have tickless timers built in, and it's something
> >>> I'd like to add to CZMQ (poll class with tickless timers).
> >>>
> >>> -Pieter
> >>> _______________________________________________
> >>> zeromq-dev mailing list
> >>> zeromq-dev at lists.zeromq.org
> >>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >>
> >>
> >>
> >>
> >> --
> >>
> >>
> >>
> >> Sincerely yours,
> >>
> >>      Apostolis Xekoukoulotakis
> >
> >
> >
> >
> > --
> >
> >
> > Sincerely yours,
> >
> >      Apostolis Xekoukoulotakis
> >
> >
> > _______________________________________________
> > zeromq-dev mailing list
> > zeromq-dev at lists.zeromq.org
> > http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> >
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



-- 


Sincerely yours,

     Apostolis Xekoukoulotakis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130205/681db9ad/attachment.html>


More information about the zeromq-dev mailing list