Twisted: 1 thread in the reactor pattern

jacopo jacopo.pecci at gmail.com
Wed Sep 23 02:08:10 EDT 2009


I am diving into Twisted and Perspective Broker (PB) in particular and
I would like to understand more about what happens behind the
curtains.
Say I have a client and a server on two different machines, the server
gets callRemote()’s in an asynchronous way, these requests are parked
in a queue and then served sequentially (not in parallel – correct me
if I am wrong). If everything is implemented in a single thread, how
is it possible that while the processor is engaged in the processing
triggered by  callRemote()’s at the same time the reactor is ready to
listen/accept new events and put them in a queue? To me it looks like
there should be at least 2 processes, one for the reactor and on for
the rest.
In the documentation they keep stressing how one of the peculiarity of
the reactor pattern is the single thread, but I can not figure out
how.

Any suggestion would be welcome.
For the time being I recommend this doc which has been the most useful
to me so far.
http://www.artima.com/weblogs/viewpost.jsp?thread=230001

Thanks, Jacopo



More information about the Python-list mailing list