[zeromq-dev] ZeroMQ with C++ and Fibers

Ian Upright ian-public at upright.net
Fri May 10 16:39:45 CEST 2013


On Thu, 9 May 2013 23:08:27 -0400, you wrote:

>On 9 May 2013 18:39, Ian Upright <ian-public at upright.net> wrote:
>
>> It's not completely clear to me how I would combine ZeroMQ with a task
>> library such as above.  Is it possible to combine the two?  If so, does
>> anyone have any idea or examples of how that could be achieved?
>
>
>Fibers are a bit old hat, Windows supports them for compatibility in
>porting.  The only caveat with 0mq is sockets passing through threads,
>fiber implementations generally do not permit fibers to migrate.
>
>The challenge with fibers is how to yield.  This would generally mean each
>fiber polling their 0mq sockets and yielding if empty.  This would
>generally lead to inefficient power usage compared with vanilla threading
>models as all the fibers will constantly spin unless under heavy traffic.

Are you sure about that?  Wouldn't it work something like this:
Suspend the Fiber, perhaps push the request to another IPC thread group that
is farming out the requests.  Then when a reply comes back in, to send it
back over IPC, and then that part would resume that Fiber which was
associated with the request/reply.  

Polling in general seems like a bad idea.

Perhaps I'm answering my own question as to how to do it?

Ian



More information about the zeromq-dev mailing list