Stackless Platform Independence?
aahz at panix.com
Mon Mar 4 05:31:58 CET 2002
In article <3C829AA2.1B21E205 at arakne.com>,
Frederic Giacometti <frederic.giacometti at arakne.com> wrote:
>Aahz Maruch wrote:
>> In article <I7Qd8.66687$dG.27729291 at news1.rdc1.sdca.home.com>,
>> Frederic Giacometti <frederic.giacometti at arakne.com> wrote:
>>>In addition to all the benefits that Christian has described so far,
>>>stackless python would make it possible to have a different OS
>>>multi-threading implementation for calling external C/C++ libraries; one
>>>that does not require interpreter lock operations.
>>>Stackless just means that function calls executed by the bytecode are
>>>executed by a C function that returns immediately; thus disconnecting
>>>the C call stack from the virtual machine call stack. In current
>>>python, they are interleaved one-on-one; making it impossible to switch
>>>context within the VM unnless you do Christian's last 'non-portable'
>>>assembly language manipulation.
>> How's that again? In the absence of pre-emptive thread scheduling, what
>> good is the immediate return from the C function? More than that, how
>> can you possibly call external libraries without the interpreter lock,
>> if those libraries have any access to Python variables? If they *don't*
>> have access to Python, how is that any different from just using the
>> macros Py_BEGIN_ALLOW_THREADS and Py_END_ALLOW_THREADS?
>Just reverse the paradigm: have the python VM run in a single thread,
>using stackless microthreads for python multithreading, and run the C
>calls in a pool of threads. This way: no lock is needed, since only
>one thread runs the VM, with the help of microthreads, and C calls run
>in other threads.
This doesn't make any sense unless you assume OS-level threads, and I
thought part of the point of Stackless was to avoid requiring OS-level
--- Aahz <*> (Copyright 2002 by aahz at pobox.com)
Hugs and backrubs -- I break Rule 6 http://www.rahul.net/aahz/
Androgynous poly kinky vanilla queer het Pythonista
"How come we choose from just two people for President but more than 50
for Miss America?" --AEN
More information about the Python-list