Threads vs Processes

sjdevnull at yahoo.com sjdevnull at yahoo.com
Fri Jul 28 18:05:48 EDT 2006


mark wrote:
> On Wed, 26 Jul 2006 10:54:48 -0700, Carl J. Van Arsdall wrote:
> > Alright, based a on discussion on this mailing list, I've started to
> > wonder, why use threads vs processes.
>
> The debate should not be about "threads vs processes", it should be
> about "threads vs events".

Events serve a seperate problem space.

Use event-driven state machine models for efficient multiplexing and
fast network I/O (e.g. writing an efficient static HTTP server)

Use multi-execution models for efficient multiprocessing.  No matter
how scalable your event-driven app is it's not going to take advantage
of multi-CPU systems, or modern multi-core processors.

Event-driven state machines can be harder to program and maintain than
multi-process solutions, but they are usually easier than
multi-threaded solutions.

On-topic: If your problem is one where event-driven state machines are
a good solution, Python generators can be a _huge_ help.




More information about the Python-list mailing list