comp.lang.ada
 help / color / mirror / Atom feed
From: Alan Brain <aebrain@dynamite.com.au>
Subject: Re: Tips for realtime embedded Ada?
Date: 1996/04/18
Date: 1996-04-18T00:00:00+00:00	[thread overview]
Message-ID: <4l54f0$sg0@fred.netinfo.com.au> (raw)
In-Reply-To: 4ku9jf$b7u@hacgate2.hac.com

John Gluth <jpGluth@ccgate.hac.com> wrote:
>Howdy,
>
>I'm looking for wisdom regarding designing software for a realtime
>embedded application.
>
>Can you suggest constructs, design philosophies, etc. to use/avoid
>to avoid inefficient code?
>
>I realise that a lot of this will be compiler/platform dependent
>(looks like we'll be going Rational/PowerPC, but not sure yet),
>but any general tips you can suggest would be greatly appreciated.

You mentioned 'Inneficient' - so I have assumed you want Best Possible 
performance, and Maintainability, Ease of Construction etc is secondary.

1) Don't use Tasking except as a Guardian of resources. Very few 
compilers do context-switching efficiently. Write a scheduler in 
assembler, or if you can, microcode.

2) The difference between efficiency of compiled code can be radically 
affected by the compiler you're using, and the version thereof. A 1994 
vintage Ada 83 compiler will in my experience almost always generate much 
more efficient code than a 1990 ANSI C Compiler - but the converse holds 
true too. Thus the decision on whether to go for 100% Ada, or 80% with 
lots of pragma interfaces to C libraries, is intimately tied in with the 
exact compiler(s) you're using.

3) Keep it simple.

4) Design cleanly: Then go through with the performance analyser, trying 
to find the areas most often executed: often 100 hours of work here to 
save 2 machine cycles gives far better results than spending 1000 hours 
to save 2000 cycles elsewhere.

FWIW, I've had really time-critical applications where much skull sweat 
was spent deciding whether to implement a bespoke scheduler, how much was 
to be in assembler, how much in C, whether to use Ada at all etc. I 
convinced management we needed a 'proof-of-principle' using a clean, 
unoptimised design in Ada first, with all checking mechanisms left in.

It exceeded the specified speed by 14% at the first attempt, saving about 
two million bucks, because all estimations had been done with a 1984 
model Ada compiler vs a 1989 model C compiler, and we used a 1992 model 
Aad compiler from a different vendor. Hence 3) above.  





  parent reply	other threads:[~1996-04-18  0:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-15  0:00 Tips for realtime embedded Ada? John Gluth
1996-04-16  0:00 ` Tom Griest
1996-04-16  0:00   ` Pat Rogers
1996-04-16  0:00 ` Stephen M. Garriga
1996-04-17  0:00 ` Daryl Siddon
1996-04-18  0:00 ` Alan Brain [this message]
1996-04-22  0:00   ` Bob Kitzberger
1996-04-23  0:00     ` Greg Bond
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox