[Stackless] Stackless for Palm Python port
jcollins at endtech.com
Mon Oct 9 04:35:54 CEST 2000
On the Palm, stack and dynamic heap are very scarce. The default stack of
4K is adjustable at the expense of dynamic heap. Of course, for recursive
C calls, no amount of stack tweaking can guarantee the prevention of stack
overflows. An overflow of the heap results in a MemoryError; an overflow
of the stack causes the device to crash.
The dynamic heap for devices running PalmOS 3.5 (eg, PalmIIIxe) is sized
depending on the total RAM - 256K on a 4MB+ device. Though this may sound
relatively large, it can be quickly consumed by PalmOS libraries (such as
the Network Library) and by the Python VM itself.
Obviously, Stackless Python will help to avoid the dreaded stack overflows
at the expense of dynamic heap. Uthreads are also needed for the Palm,
since there is no threading currently available. Before I begin the port,
here are a few questions:
1) What is the overhead imposed by the new/modified objects?
2) The current uthread.py module is quite large (approx 1500 LOC) and
will consume a large chunk of dynamic heap on import alone. I read that
there are plans to convert this to C. Will this happen any time soon?
3) I haven't thought much about using uthreads in an event-loop
situation. LispMe steps a thread along with each iteration of the event
loop. This is also remeniscent of Will Ware's original uthread
implementation, where the scheduler is user defined. What are the
potential problems with uthreads in an event-loop environment?
Python-1.5.2+ (post-string methods, pre-unicode) is the version ported to
the Palm and I will need Stackless for this; an upgrade to 2.0 is
planned, but not for a couple of months.
Jeffery D. Collins
Sr. Software Developer
Endeavors Technology, Inc.
Stackless mailing list
Stackless at starship.python.net
More information about the Stackless