From owner-freebsd-questions@FreeBSD.ORG Tue Dec 16 14:29:46 2008 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 49CE0106564A for ; Tue, 16 Dec 2008 14:29:46 +0000 (UTC) (envelope-from talon@lpthe.jussieu.fr) Received: from shiva.jussieu.fr (shiva.jussieu.fr [134.157.0.129]) by mx1.freebsd.org (Postfix) with ESMTP id D203E8FC14 for ; Tue, 16 Dec 2008 14:29:45 +0000 (UTC) (envelope-from talon@lpthe.jussieu.fr) Received: from parthe.lpthe.jussieu.fr (parthe.lpthe.jussieu.fr [134.157.10.1]) by shiva.jussieu.fr (8.14.3/jtpda-5.4) with ESMTP id mBGEThUT070193 for ; Tue, 16 Dec 2008 15:29:43 +0100 (CET) X-Ids: 165 Received: from niobe.lpthe.jussieu.fr (niobe.lpthe.jussieu.fr [134.157.10.41]) by parthe.lpthe.jussieu.fr (Postfix) with ESMTP id 733BA89C15 for ; Tue, 16 Dec 2008 15:29:42 +0100 (CET) Received: by niobe.lpthe.jussieu.fr (Postfix, from userid 2005) id 621F73D; Tue, 16 Dec 2008 15:29:42 +0100 (CET) Date: Tue, 16 Dec 2008 15:29:42 +0100 From: Michel Talon To: freebsd-questions@freebsd.org Message-ID: <20081216142942.GA14998@lpthe.jussieu.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4.2.3i X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.0.1 (shiva.jussieu.fr [134.157.0.165]); Tue, 16 Dec 2008 15:29:43 +0100 (CET) X-Virus-Scanned: ClamAV 0.94.2/8766/Tue Dec 16 13:29:53 2008 on shiva.jussieu.fr X-Virus-Status: Clean X-Miltered: at jchkmail2.jussieu.fr with ID 49479F5B.00F by Joe's j-chkmail (http : // j-chkmail dot ensmp dot fr)! X-j-chkmail-Enveloppe: 49479F5B.00F/134.157.10.1/parthe.lpthe.jussieu.fr/parthe.lpthe.jussieu.fr/ X-j-chkmail-Score: MSGID : 49479F5B.00F on jchkmail2.jussieu.fr : j-chkmail score : . : R=. U=. O=. B=0.016 -> S=0.016 X-j-chkmail-Status: Ham Subject: Re: Python with many threads X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 16 Dec 2008 14:29:46 -0000 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