Threads, forks, multiplexing - oh my

James Mills prologic at shortcircuit.net.au
Mon Dec 22 03:02:38 CET 2008


On Mon, Dec 22, 2008 at 11:36 AM, Thomas Raef <traef at ebasedsecurity.com> wrote:
> I now want to run multiple instances of this program on a client, after
> receiving the command line and args from a broker, dispatcher, whatever you
> want to call it.

You can use the subprocess module.

> I've read where forks will run programs but they replace the calling program
> – is that correct? Am I reading that right? If so, then my client program
> will have to use forks so it can run a program. Then are threads to run
> functions and not full-fledged programs?

Forking creates a clone/child
process of the parent.

You probably want os.system
or subprocess.

> When, if ever, would I want to look at implementing multiplexing?

Single-process multiplexing (think event-driven)
can often be far better in terms of performance.

--JamesMills


More information about the Python-list mailing list