Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 16 Dec 2008 15:29:42 +0100
From:      Michel Talon <talon@lpthe.jussieu.fr>
To:        freebsd-questions@freebsd.org
Subject:   Re: Python with many threads
Message-ID:  <20081216142942.GA14998@lpthe.jussieu.fr>

next in thread | raw e-mail | index | archive | help
Otto wrote:

> Exception in thread 30:
> Traceback (most recent call last):
>   File "/usr/local/lib/python2.5/threading.py", line 486, in
> __bootstrap_in=
> ner
>     self.run()
> 
> The number of errors increases rapidly with even bigger number of
> threads.
> Is there any way I can increase the maximum number of Python threads?


Nothing limits the number of concurrent threads. Personnally i have
checked i can run Grub Next Generation Python Client with 600 threads
without any problem.
niobe% uname -a
FreeBSD niobe.lpthe.jussieu.fr 7.0-STABLE FreeBSD 7.0-STABLE #0: Tue Jul
22 10:31:01 CEST 2008
niobe% python
Python 2.5.2 (r252:60911, Jul  5 2008, 13:44:44) 

Recall that python threads are just native threads, but these threads
are protected from trashing the python state by a single lock, the GIL,
which is released when you do IO. This allows to effectively thread IO,
but not python computation. The FreeBSD thread library has no particular
limitations, you can run hundreds or thousands of threads without much
problem, for example under Java.


-- 

Michel TALON




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20081216142942.GA14998>