Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #77194

Re: Thread terminate

Date 2014-08-28 11:19 +0200
From Ervin Hegedüs <airween@gmail.com>
Subject Re: Thread terminate
References <20140827185514.GA18660@arxnet.hu> <CALvWhxsJW+pDKYnf9iZzRHsUg6V9wbNjp=3VqEjGSomez_WQEw@mail.gmail.com> <mailman.13546.1409215846.18130.python-list@python.org> <87sikhf0m2.fsf@elektro.pacujo.net>
Newsgroups comp.lang.python
Message-ID <mailman.13548.1409217460.18130.python-list@python.org> (permalink)

Show all headers | View raw


Hi Marko,

On Thu, Aug 28, 2014 at 12:02:29PM +0300, Marko Rauhamaa wrote:
> Ervin Hegedüs <airween@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.

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: Thread terminate Ervin Hegedüs <airween@gmail.com> - 2014-08-28 10:52 +0200
  Re: Thread terminate Marko Rauhamaa <marko@pacujo.net> - 2014-08-28 12:02 +0300
    Re: Thread terminate Ervin Hegedüs <airween@gmail.com> - 2014-08-28 11:19 +0200
    Re: Thread terminate Cameron Simpson <cs@zip.com.au> - 2014-08-29 08:30 +1000

csiph-web