lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]

On Saturday 31 May 2003 23.51, Roberto Ierusalimschy wrote:
> > Can the worst case delay be bounded? Yes, if the algorithm is
> > right!
> If you traverse the stack, you can only bound the worst case delay
> if you bound your stack size. This is the kind of programming
> discipline I am talking about.
> > Either way, what is so special about scripting languages that
> > they cannot be used in hard real time applications?
> Pervasive use of dynamic memory allocation + garbage collection.

Many languages that are not referred to as scripting languages do that 
as well, but well, it's just a matter of definition. To me, anything 
that has the compiler built in (or interprets directly) is a 
scripting language. (I think... I don't really care all that much, 
because all that matters is whether it does the job or not.)

> > Well, that's the fist thing everyone gets wrong. DON'T use
> > dynamic allocation in the first place. Simple as that.
> That is what I said.  ("This is difficult even for hard languages
> doing dynamic memory allocation.")

Ah, sorry. So we're basically saying the same thing: It's not VM vs 
native code that makes the difference; it's memory management.

Anyway, RT "dynamic" memory allocation is hairy, but as I said, you 
can always use pre-allocated and locked memory along with suitable 
algorithms. Dynamic memory management is not soft real time by 
definition. It *may* however increase system complexity to a level 
where it might be unrealistic to base reliability calculations on 
anything other than results from extensive testing. "Ok, we've stress 
tested it for 100 hours straight, and it still haven't missed a 
deadline. That will do."

//David Olofson - Programmer, Composer, Open Source Advocate

.- The Return of Audiality! --------------------------------.
| Free/Open Source Audio Engine for use in Games or Studio. |
| RT and off-line synth. Scripting. Sample accurate timing. |
`-----------------------------------> -'
   --- --- ---