wasm-demo/demo/ermis-f/python_m/cur/0190

52 lines
1.9 KiB
Plaintext

From: amaranda at nospam.com (Alex Maranda)
Date: Thu, 15 Apr 1999 10:29:18 +0100
Subject: threads
References: <1288080841-20523503@hypernet.com>
<Pine.LNX.4.04.9904131722450.14793-100000@england.local.net> <1288067824-21306356@hypernet.com>
Message-ID: <3715B16E.542B@nospam.com>
Content-Length: 1570
X-UID: 190
Gordon McMillan wrote:
>
> Eric Lee Green writes:
>
> > Ah. Okay. So Python is doing user-land threads and not Posix
> > (OS-level) threads?
>
> Nope. Those are OS threads. It's just that there's an interpreter
> lock, which only gets released every N byte-code instructions.
This is kind of misleading. Posix threads can be both user level or
kernel level, depending on the contention scope passed to
pthread_create() (PTHREAD_SCOPE_PROCESS/PTHREAD_SCOPE_SYSTEM).
excerpt from Python-1.5.2/Python/thread_pthread.h:
/* set default attribute object for different versions */
#if defined(PY_PTHREAD_D4) || defined(PY_PTHREAD_D7)
# define pthread_attr_default pthread_attr_default
# define pthread_mutexattr_default pthread_mutexattr_default
# define pthread_condattr_default pthread_condattr_default
#elif defined(PY_PTHREAD_STD) || defined(PY_PTHREAD_D6)
# define pthread_attr_default ((pthread_attr_t *)NULL)
# define pthread_mutexattr_default ((pthread_mutexattr_t *)NULL)
# define pthread_condattr_default ((pthread_condattr_t *)NULL)
#endif
On my machine, Solaris2.5.1, I'm pretty sure it goes on #elif, so I get
a null ptr (defaults to user level threads). It doesn't matter on SMP
machines anyway because of the interpreter lock.
BTW, any estimate (Guido?) on when will the interpreter be fully
reentrant? (1.6? 2.0?)
Cheers,
--
Alex Maranda mailto: amaranda at spider dot com
Spider Software Ltd. Tel: +44 (0)131 4757036
Edinburgh, UK http://members.xoom.com/Alex_Maranda
STREAMS based communications protocols for embedded systems