Parallelization on muli-CPU hardware?
Aahz
aahz at pythoncraft.com
Thu Oct 7 14:57:37 EDT 2004
In article <1glawed.1e83ntp1ck15pvN%aleaxit at yahoo.com>,
Alex Martelli <aleaxit at yahoo.com> wrote:
>Aahz <aahz at pythoncraft.com> wrote:
>> In article <1glatga.8upk9brifr2qN%aleaxit at yahoo.com>,
>> Alex Martelli <aleaxit at yahoo.com> wrote:
>>>Aahz <aahz at pythoncraft.com> wrote:
>>>>
>>>> The problem is that CPython doesn't have thread-local storage.
>>>
>>>In 2.4 it does -- see threading.local documentation at
>>><http://www.python.org/dev/doc/devel/lib/module-threading.html> (and
>>>even better, the docstring of the new _threading_local module).
>>
>> IIUC, that's not thread-local storage in the sense that I'm using the
>> term (and which I believe is standard usage). Values created with
>> thread-local storage module are still allocated on the heap, and it's
>> still possible to use introspection to access thread-local data in
>> another thread.
>
>Is it...? Maybe I'm missing something...:
If you look at the code for _threading_local, you'll see that it depends
on __getattribute__() to acquire a lock and patch in the current
thread's local state. IIRC from the various threads about securing
Python, there are ways to break __getattribute__(), but I don't remember
any off-hand (and don't have time to research).
--
Aahz (aahz at pythoncraft.com) <*> http://www.pythoncraft.com/
WiFi is the SCSI of the 21st Century -- there are fundamental technical
reasons for sacrificing a goat. (with no apologies to John Woods)
More information about the Python-list
mailing list