(You're top-posting.  Put your remarks AFTER what you're quoting)

On 11/16/2011 12:52 PM, Jack Keegan wrote:
Ok, I thought that processes would do the same job as threads. So would the
general rule be some thing like so:

If I want another piece of work to run (theoretically) along side my main
script, and I want to share data between them, I should use a thread and
share data with the thread-safe queue.
If the work I want done can function and complete on its own, go for a
process.

Would that be about right?


Yes, with all the caveats I mentioned before. With some language implementations, and with some operating systems, and on some CPU-systems, the guidelines could be different. They all trade off in ways too complex to describe here.

For example, if a thread is mostly doing I/O, it may be just as efficient as a separate process, even if sharing data isn't an issue.

And in some languages, sharing data between processes isn't all that tough, either.


--

DaveA
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to