Imitating "tail -f"

exarkun at exarkun at
Mon Nov 30 15:36:38 CET 2009

On 11:15 am, paul at wrote:
>On 22 Nov, 05:10, exar... at wrote:
>>"tail -f" is implemented by sleeping a little bit and then reading to
>>see if there's anything new.
>This was the apparent assertion behind the "99 Bottles" concurrency
>However, as I pointed out (and as others have pointed out here), a
>realistic emulation of "tail -f" would actually involve handling
>events from operating system mechanisms. Here's the exchange I had at
>the time:
>It can be very tricky to think up good examples of multiprocessing
>(which is what the above page was presumably intended to investigate),
>as opposed to concurrency (which can quite easily encompass responding
>to events asynchronously in a single process).
>P.S. What's Twisted's story on multiprocessing support? In my limited
>experience, the bulk of the work in providing usable multiprocessing
>solutions is in the communications handling, which is something
>Twisted should do very well.

Twisted includes a primitive API for launching and controlling child 
processes, reactor.spawnProcess.  It also has several higher-level APIs 
built on top of this aimed at making certain common tasks more 
convenient.  There is also a third-party project called Ampoule which 
provides a process pool to which it is is relatively straightforward to 
send jobs and then collect their results.


More information about the Python-list mailing list