Re: Threads vs. processes, what to consider in choosing ?

2009-02-17 Thread Christian Heimes
Philip Semanchuk wrote: > The general rule is that it is a lot easier to share data between > threads than between processes. The multiprocessing library makes the > latter easier but is only part of the standard library in Python >= 2.6. > The design of your application matters a lot. For instance

Re: Threads vs. processes, what to consider in choosing ?

2009-02-17 Thread Philip Semanchuk
On Feb 17, 2009, at 10:18 AM, Barak, Ron wrote: I have a wxPython application that builds an internal database from a list of files and then displays various aspects of that data, in response to user's requests. I want to add a module that finds events in a set of log files (LogManager). T

Threads vs. processes, what to consider in choosing ?

2009-02-17 Thread Barak, Ron
Hi, May I have your recommendations in choosing threads or processes for the following ? I have a wxPython application that builds an internal database from a list of files and then displays various aspects of that data, in response to user's requests. I want to add a module that finds events

Re: Threads vs Processes

2006-07-28 Thread [EMAIL PROTECTED]
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

Re: Threads vs Processes

2006-07-28 Thread [EMAIL PROTECTED]
sturlamolden wrote: > Chance Ginger wrote: > > > Not quite that simple. In most modern OS's today there is something > > called COW - copy on write. What happens is when you fork a process > > it will make an identical copy. Whenever the forked process does > > write will it make a copy of the memo

Re: Threads vs Processes

2006-07-28 Thread bryanjugglercryptographer
sturlamolden wrote: > A noteable exception is a toy OS from a manufacturer in Redmond, > Washington. It does not do COW fork. It does not even fork. > > To make a server system scale well on Windows you need to use threads, > not processes. Here's one to think about: if you have a bunch of thread

Re: Threads vs Processes

2006-07-28 Thread sturlamolden
Chance Ginger wrote: > Not quite that simple. In most modern OS's today there is something > called COW - copy on write. What happens is when you fork a process > it will make an identical copy. Whenever the forked process does > write will it make a copy of the memory. So it isn't quite as bad.

Re: Threads vs Processes

2006-07-28 Thread mark
On Thu, 27 Jul 2006 20:53:54 -0700, Nick Vatamaniuc wrote: > Debugging all those threads should be a project in an of itself. Ahh, debugging - I forgot to bring that one up in my argument! Thanks Nick ;) Certainly I agree of course that there are many applications which suit a threaded design. I

Re: Threads vs Processes

2006-07-28 Thread Tobias Brox
[mark] > http://twistedmatrix.com/projects/core/documentation/howto/async.html . At my work, we started writing a web app using the twisted framework, but it was somehow too twisted for the developers, so actually they chose to do threading rather than using twisted's async methods. -- Tobias Br

Re: Threads vs Processes

2006-07-28 Thread H J van Rooyen
"Dennis Lee Bieber" <[EMAIL PROTECTED]> Wrote: | On Thu, 27 Jul 2006 09:17:56 -0700, "Carl J. Van Arsdall" | <[EMAIL PROTECTED]> declaimed the following in comp.lang.python: | | > Ah, alright, I think I understand, so threading works well for sharing | > python objects. Would a scenario for this

Re: Threads vs Processes

2006-07-27 Thread Nick Vatamaniuc
in the same number of lines having the same or better performance. I bet you'll end up having a whole bunch of 'locks', 'waits' and 'notify's instead of a bunch of "those 'deferred' things." Debugging all those threads should be a project in an o

Re: Threads vs Processes

2006-07-27 Thread bryanjugglercryptographer
mark wrote: > The debate should not be about "threads vs processes", it should be > about "threads vs events". We are so lucky as to have both debates. > Dr. John Ousterhout (creator of Tcl, > Professor of Comp Sci at UC Berkeley, etc), started a famous debate &g

Re: Threads vs Processes

2006-07-27 Thread mark
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"

Re: Threads vs Processes

2006-07-27 Thread Carl J. Van Arsdall
[EMAIL PROTECTED] wrote: > Carl J. Van Arsdall wrote: > [...] > >> I actually do use pickle (not for this, but for other things), could you >> elaborate on the safety issue? >> > > >From http://docs.python.org/lib/node63.html : > > Warning: The pickle module is not intended to be secure

Re: Threads vs Processes

2006-07-27 Thread bryanjugglercryptographer
Carl J. Van Arsdall wrote: [...] > I actually do use pickle (not for this, but for other things), could you > elaborate on the safety issue? >From http://docs.python.org/lib/node63.html : Warning: The pickle module is not intended to be secure against erroneous or maliciously constructed

Re: Threads vs Processes

2006-07-27 Thread Carl J. Van Arsdall
[EMAIL PROTECTED] wrote: > Carl J. Van Arsdall wrote: > >> Ah, alright, I think I understand, so threading works well for sharing >> python objects. Would a scenario for this be something like a a job >> queue (say Queue.Queue) for example. This is a situation in which each >> process/thread n

Re: Threads vs Processes

2006-07-27 Thread Grant Edwards
On 2006-07-27, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: >> If you're sharing things, I would thread. I would not want to >> pay the expense of a process. > > This is generally a false cost. There are very few > applications where thread/process startup time is at all a > fast path, Even if i

Re: Threads vs Processes

2006-07-27 Thread bryanjugglercryptographer
Carl J. Van Arsdall wrote: > Ah, alright, I think I understand, so threading works well for sharing > python objects. Would a scenario for this be something like a a job > queue (say Queue.Queue) for example. This is a situation in which each > process/thread needs access to the Queue to get the

Re: Threads vs Processes

2006-07-27 Thread John Henry
Nick Craig-Wood wrote: > > Here is test prog... > Here's a more real-life like program done in both single threaded mode and multi-threaded mode. You'll need PythonCard to try this. Just to make the point, you will notice that the core code is identical between the two (method on_menuFileStart

Re: Threads vs Processes

2006-07-27 Thread Shitiz Bansal
How do i share memory between processes?"[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: John Henry wrote:> If you're sharing things, I would thread. I would not want to pay the> expense of a process.This is generally a false cost. There are very few applications wherethread/process startup time is

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
John Henry wrote: > If you're sharing things, I would thread. I would not want to pay the > expense of a process. This is generally a false cost. There are very few applications where thread/process startup time is at all a fast path, and there are likewise few where the difference in context sw

Re: Threads vs Processes

2006-07-27 Thread John Henry
[EMAIL PROTECTED] wrote: > [EMAIL PROTECTED] wrote: > > John Henry wrote: > > > Granted. Threaded program forces you to think and design your > > > application much more carefully (to avoid race conditions, dead-locks, > > > ...) but there is nothing inherently *non-robust* about threaded > > > a

Re: Threads vs Processes

2006-07-27 Thread Carl J. Van Arsdall
[EMAIL PROTECTED] wrote: > Carl J. Van Arsdall wrote: > >> Alright, based a on discussion on this mailing list, I've started to >> wonder, why use threads vs processes. >> > > In many cases, you don't have a choice. If your Python program > is

Re: Threads vs Processes

2006-07-27 Thread Gerhard Fiedler
On 2006-07-26 19:10:14, Carl J. Van Arsdall wrote: > Ah, alright. So if that's the case, why would you use python threads > versus spawning processes? If they both point to the same address space > and python threads can't run concurrently due to the GIL what are they > good for? Nothing run

Re: Threads vs Processes

2006-07-27 Thread Steve Holden
Carl J. Van Arsdall wrote: > Paul Rubin wrote: > >>"Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes: >> >> >>>Processes seem fairly expensive from my research so far. Each fork >>>copies the entire contents of memory into the new process. >>> >> >>No, you get two processes whose address spa

Re: Threads vs Processes

2006-07-27 Thread Nick Craig-Wood
[EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Yes, someone can, and that someone might as well be you. > How long does it take to create and clean up 100 trivial > processes on your system? How about 100 threads? What > portion of your user waiting time is that? Here is test prog... The resu

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
[EMAIL PROTECTED] wrote: > John Henry wrote: > > Granted. Threaded program forces you to think and design your > > application much more carefully (to avoid race conditions, dead-locks, > > ...) but there is nothing inherently *non-robust* about threaded > > applications. > > Indeed. Let's just g

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
Russell Warren wrote: > This is something I have a streak of paranoia about (after discovering > that the current xmlrpclib has some thread safety issues). Is there a > list maintained anywhere of the modules that are aren't thread safe? It's much safer to work the other way: assume that librari

Re: Threads vs Processes

2006-07-27 Thread [EMAIL PROTECTED]
John Henry wrote: > > > > 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 th

Re: Threads vs Processes

2006-07-26 Thread bryanjugglercryptographer
Carl J. Van Arsdall wrote: > Alright, based a on discussion on this mailing list, I've started to > wonder, why use threads vs processes. In many cases, you don't have a choice. If your Python program is to run other programs, the others get their own processes. There's no t

Re: Threads vs Processes

2006-07-26 Thread Joe Knapka
John Henry wrote: > >>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 sol

Re: Threads vs Processes

2006-07-26 Thread Gerhard Fiedler
On 2006-07-26 21:02:59, John Henry wrote: > Granted. Threaded program forces you to think and design your > application much more carefully (to avoid race conditions, dead-locks, > ...) but there is nothing inherently *non-robust* about threaded > applications. You just need to make sure that ev

Re: Threads vs Processes

2006-07-26 Thread John Henry
> > 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

Re: Threads vs Processes

2006-07-26 Thread Paddy
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

Re: Threads vs Processes

2006-07-26 Thread Russell Warren
Oops - minor correction... xmlrpclib is fine (I think/hope). It is SimpleXMLRPCServer that currently has issues. It uses thread-unfriendly sys.exc_value and sys.exc_type... this is being corrected. -- http://mail.python.org/mailman/listinfo/python-list

Re: Threads vs Processes

2006-07-26 Thread Carl J. Van Arsdall
Paul Rubin wrote: > "Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes: > >> Processes seem fairly expensive from my research so far. Each fork >> copies the entire contents of memory into the new process. >> > > No, you get two processes whose address spaces get the data. It's > done with

Re: Threads vs Processes

2006-07-26 Thread Russell Warren
> Another issue is the libraries you use. A lot of them aren't > thread safe. So you need to watch out. This is something I have a streak of paranoia about (after discovering that the current xmlrpclib has some thread safety issues). Is there a list maintained anywhere of the modules that are are

Re: Threads vs Processes

2006-07-26 Thread Paul Rubin
"Carl J. Van Arsdall" <[EMAIL PROTECTED]> writes: > Processes seem fairly expensive from my research so far. Each fork > copies the entire contents of memory into the new process. No, you get two processes whose address spaces get the data. It's done with the virtual memory hardware. The data i

Re: Threads vs Processes

2006-07-26 Thread John Henry
Chance Ginger 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. So, If I have a system that has a > > large area of shared

Re: Threads vs Processes

2006-07-26 Thread Chance Ginger
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. So, If I have a system that has a > large area of shared memory, which would be better? I've been

Threads vs Processes

2006-07-26 Thread Carl J. Van Arsdall
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 ex