Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 7 Feb 2004 11:14:09 +0900
From:      Hye-Shik Chang <freebsdports@pipiband.com>
To:        Daniel Eischen <eischen@vigrid.com>
Cc:        Julian Elischer <julian@elischer.org>
Subject:   Re: Python and system vs process scope threads (was Re: python ports broken (sem_destroy: Resource temporarily)
Message-ID:  <20040207021409.GA33111@i18n.org>
In-Reply-To: <Pine.GSO.4.10.10402061803580.18636-100000@pcnet5.pcnet.com>
References:  <Pine.BSF.4.21.0402061458450.24800-100000@InterJet.elischer.org> <Pine.GSO.4.10.10402061803580.18636-100000@pcnet5.pcnet.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Fri, Feb 06, 2004 at 06:11:57PM -0500, Daniel Eischen wrote:
> A brief synopsis:
> 
> The python port uses system scope threads, or at least the
> test_threaded_import.py test in /usr/local/lib/python2.3/test
> does.  Is there a reason python uses system scope threads
> instead of process scope threads?  It is more efficient
> and consumes less resources in FreeBSD if it were to use
> scope process threads.

Python uses system scope threads to make thread running run
like more human-expected. (The discussion was here:
http://groups.google.com/groups?threadm=slrn9ppgeb.mvb.bbrox%40bbland.bbrox.com&rnum=2)
With system scope, it runs:

% python ~/testthread.py
thread 0 begin
thread 1 begin
thread 2 begin
thread 3 begin
thread 4 begin
thread 0 end
thread 1 end
thread 3 end
thread 2 end
thread 4 end

But with process scope, it runs:

% ./python ~/testthread.py
thread 0 begin
thread 0 end
thread 1 begin
thread 1 end
thread 2 begin
thread 2 end
thread 3 begin
thread 3 end
thread 4 begin
thread 4 end


Because our libc_r did system scope threads similar as process
scope, python threads have been scheduled like the latter one on
the previous FreeBSD releases. So even patching to use process scope
threads on the port will not hurt backward-compatibility.

Okay. I'll fix it on the port. Thanks for your investigation!
KSE rocks! ;)


Cheers,
Hye-Shik



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