Threads vs Processes

Paddy paddy3118 at netscape.net
Wed Jul 26 18:17:35 EDT 2006


Carl J. Van Arsdall wrote:
> Alright, based a on discussion on this mailing list, I've started to
> wonder, why use threads vs processes.  So, If I have a system that has a
> large area of shared memory, which would be better?  I've been leaning
> towards threads, I'm going to say why.
>
> Processes seem fairly expensive from my research so far.  Each fork
> copies the entire contents of memory into the new process.  There's also
> a more expensive context switch between processes.  So if I have a
> system that would fork 50+ child processes my memory usage would be huge
> and I burn more cycles that I don't have to.  I understand that there
> are ways of IPC, but aren't these also more expensive?
>
> So threads seems faster and more efficient for this scenario.  That
> alone makes me want to stay with threads, but I get the feeling from
> people on this list that processes are better and that threads are over
> used.  I don't understand why, so can anyone shed any light on this?
>
>
> Thanks,
>
> -carl
>
> --
>
> Carl J. Van Arsdall
> cvanarsdall at mvista.com
> Build and Release
> MontaVista Software

Carl,
 OS writers provide much more tools for debugging, tracing, changing
the priority of, sand-boxing processes than threads (in general) It
*should* be easier to get a process based solution up and running
andhave it be more robust, when compared to a threaded solution.

- Paddy (who shies away from threads in C and C++ too ;-)




More information about the Python-list mailing list