Thread terminate

Ervin Hegedüs airween at gmail.com
Thu Aug 28 05:19:06 EDT 2014


Hi Marko,

On Thu, Aug 28, 2014 at 12:02:29PM +0300, Marko Rauhamaa wrote:
> Ervin Hegedüs <airween at gmail.com>:
> 
> > at this time there is only one thread, as you wrote. I just try
> > to prepare it to higher load, when one thread will not enough...
> 
> Threads are a necessary evil when dealing with blocking function calls,
> but evil they remain. I would generally *not* associate a thread for
> each parallel context but work with a limited thread pool, whose size is
> independent of the number of contexts. Often, a good rule of thumb is to
> have two threads per CPU core to get most out of the hardware.

thanks - I didn't plan to increase of size of thread pool to
greather than 2-4 - the server has 4 CPU.

> Since you talked about forking, you might be better served with a pool
> of processes instead of threads since processes have less surprising
> semantics and, if push came to shove, you can kill them with a signal.

life with threads are better in my case - the shared memory is a
big advantage. That's the only reason... :)


Thanks,


a.



More information about the Python-list mailing list