Python for embedded systems (was Re: What does Python do)

Grant Edwards grante at visi.com
Wed Jan 24 10:35:01 EST 2001


In article <3A6E66EE.38FEB4F0 at engcorp.com>, Peter Hansen wrote:

>> >... On the other hand the threading model could mess things up
>> >for you, but if you focus on a specific platform, even that is
>> >not necessarily a problem.
>> 
>> The current threading implementation is inappropriate for
>> real-time work, but I don't know why one couldn't implement
>> prioritized preemptive threading for Python.
>
>I think the global interpreter lock would be the thing that
>would get in the way there.  I'm not sure to what extent this
>is true, but I believe a lower priority thread can block a
>higher priority thread for a possibly very large time.  It's
>possibly still deterministic, and therefore still "real-time",
>but not necessarily high performance.  I wouldn't bet my life
>on it yet, since I still need to study the core more.

I think you'd want a thread to be preemptable between any two
bytecodes with explicit mutex operations where multiple threads
desire to operate on shared data.  The finer the granularity
the better, but switching threads during byte code execution
would probably be pretty difficult.

If you do interrupt routines in C it shouldn't be too bad.  If
you want to do interrupt routines in Python, things get a lot
more complicated.

-- 
Grant Edwards                   grante             Yow!  Loni Anderson's hair
                                  at               should be LEGALIZED!!
                               visi.com            



More information about the Python-list mailing list