a soft real-time system using pythonm

Peter Hansen peter at engcorp.com
Thu Aug 1 01:31:26 CEST 2002


Jeff Epler wrote:
> 
> Reference counting is the cause of unbounded delays for simple
> assignments, as in the second statement of
>     x = [unique() for i in range(1000*1000)]
>     x = 3
> each unique() that was in x will be cleaned up by reference counting at
> the time of the second assignment.  There's no easy way to place a limit
> on the size of containers.

Sure there is!  Don't create any container bigger than M items...

Given that the soft realtime systems in question are likely not supposed
to run code from unprotected sources, why would it be difficult to
simply avoid creating really large containers?

> IMO, even "soft" realtime based on Python threads is not going to fly.
> These items are just off the top of my head, I'm sure there are more.
> And more still in any extension module you'd like to include.

Well, working in a company which has been developing soft realtime 
(embedded and server-based) systems based on Python threads running
on Linux for quite some time, I have to disagree with you.  Our products
are functioning in the field with acceptable performance and we
haven't had any reported cases of containers suddenly blossoming to
1000*1000 items and bringing the system to its knees.

There's an expression used often in XP circles in response to people
saying things like "if you create a billion instances of class Unique
you might have problems".  The response is something like "Doctor, 
it hurts when I create a billion objects" and the implied answer is
of course "stop doing it".

-Peter



More information about the Python-list mailing list