How to schedule system calls with Python

Christian Heimes lists at cheimes.de
Fri Oct 16 06:21:41 EDT 2009


MRAB wrote:
> You could use multithreading: put the commands into a queue; start the
> same number of worker threads as there are processors; each worker
> thread repeatedly gets a command from the queue and then runs it using
> os.system(); if a worker thread finds that the queue is empty when it
> tries to get a command, then it terminates.

Threads aren't necessary here and the OP shouldn't use os.system()
either. The subprocess module is superior and makes the solution much
either without the need for threads.

Christian




More information about the Python-list mailing list