a soft real-time system using pythonm

Chris Liechti cliechti at gmx.net
Wed Jul 31 14:51:59 EDT 2002


anton wilson <anton.wilson at camotion.com> wrote in
news:mailman.1028133225.32205.python-list at python.org: 

> O
>> A realtime system places an upper bound on all operations, but the
>> very nature of Python makes this impractical if not impossible.
>>
>> An interaction between Python's handling of the GIL and the
>> platform's pthread library is going to be the least of your problems
>> if you actually intend to deliver a system which gives realtime
>> guarantees on Python programs.
>>
>> Jeff
> 
> 
> If the soft-real-time system we use makes simple function calls and
> only uses simple datatypes and possibly tuples, what are some of the
> potential pitfalls we could run into?

depends on your timing caonstaints. you're speaking of seconds or 
milliseconds? i don't see a problem if you're talking about seconds or half 
seconds.

> I understand the deallocation
> issue and the garbage collection issue. (Does garbage collection have
> to be enabled?)

garbage collecting in python is only useful when you have data in cycles 
(self made linked lists etc.) you can avoid that and turn off the gc (it 
probably won't disturb anyway)

> Can we somehow get an idea on the worse case time
> delays in python using only simple function calls and assignments with
> small tuples and simple datatypes? 

python is a bit slower than say a C program, so your latency times are 
likely to be higher due to the slower execution time. but apart from that 
its more a problem of the OS. as you have seen in the original thread, the 
threading implementation of the OS can vary.

however, i'm using python in soft-realtime applications. one delivers data 
over the serial port every 250ms and the PC should answer back within 80ms.
this works realy great and i'm even running a wxPython GUI in the same 
process. it runs on win98, NT, 2k, linux. i never had problems with 200MHz 
pentiums and 64MB RAM. (on an embedded linux board 16MB RAM PPC at 50MHz 
running only a console version of the same programm is possible, but on 
the edge)

chris
-- 
Chris <cliechti at gmx.net>




More information about the Python-list mailing list