On Fri, 15 Jun 2012 11:51:01 -0400
Dave Angel <d...@davea.name> wrote:

> On 06/15/2012 09:49 AM, John O'Hagan wrote:
> > I have a program in which the main thread launches a number of CPU-intensive
> > worker threads. For each worker thread two python subprocesses are started,
[...]
> >
> > So far so good, but it occurred to me that instead of launching all these
> > worker threads, I could just put their target code in separate executable
> > files and launch them as subprocesses. That way there would be fewer
> > threads, but each subprocess would be doing more work. 
> >
> > My question is, on a single core machine, what are the pros and cons of
> > threads vs subprocesses in a setup like this? 
> >
[...]
> 
> Two key phrases in your message;   CPU-intensive,  
> single-core-machine.  If these have the conventional meaning, you're
> better off doing all the processing in your main executable, without
> threads at all.
> 
> Neither threads nor separate process speed up CPU-intensive execution on
> a single-core machine.
[...]

I should have made it clear that I'm not using threads to speed anything up;
each thread produces an independently controlled, timed stream of musical
events. I think it would be hard to achieve that in a single process. The
streams need to run simultaneously without getting out of sync or dropping
notes, which begins to happen if there are a lot of them, or they are run very
fast or are very calculation-intensive to produce. 

So I guess what I'm really asking is, given that I need to use threads or
subprocesses, which approach slows the processing down the least?


John
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to