[comp.realtime] Re^2: "Easy" way to put "AI" in realtime embedded systems?

kend@data.UUCP (Ken Dickey) (04/15/91)

rlk@telesoft.com (Bob Kitzberger @sation) writes:

>I don't prefess to be anything near a LISP expert, but I'll toss out
>a few questions you need to ask yourself. 

> Can you calculate guaranteed 
>worst-case times for LISP routines in the presence of interrupts?  

Yes.  Just like C/asm/whatever.


>How 
>about the dynamic memory allocation algorithms used in LISP -- are they 
>non-deterministic?

One has to be a bit smart about this.  The standard real-time strategy
for any language is static (pre)allocation.  For dynamic allocation,
one typically maintains a "free-list" of the appropriate storage size
to guarentee maximum allocation times [even in C, one tends to use
power-of-2 fixed-size heaps and a buddy-system allocation rather than
1st-fit].


>   How can you protect LISP data structures in the 
>presence of concurrency?

Same way as for any other language.  As a matter of fact, if you have
1st class continuations you can write a much smaller OS kernel.**


>  Is reclamation of stale heap space performed?

In any hard-real-time systems I have seen, storage allocations are all
precalculated.  To allow general GC, one (A) Calculates the size of
the maximum heap needed by any processing between GC's, and (B)
Schedules GC just as any other task to be performed.

In general, compilers for modern Lisps such as Scheme are comparable
to C in code speed/space, use somewhat larger representations for heap
objects, are more memory efficient in general (because there is no
extra code for storage management decisions), and are much more
flexible with fewer bugs (no pointer abstraction => don't dereference
bogus pointers, etc).  Real-time usages and problems are the same as
for other languages.

-Ken Dickey					kend@data.uucp
----------------------
**
%A Mitchell Wand
%T Continuation-Based Multiprocessing
%J Conference Record of the 1980 Lisp Conference
%P 19-28
%I The Lisp Conference
%D 1980