[comp.lang.ada] AdaZ Tasking: Arghh!

ftpam1@acad3.alaska.edu (MUNTS PHILLIP A) (12/21/90)

     I bought AdaZ (soon to be named something else) from Meridian this
week.  Since I am a hardware oriented person, my first efforts with the
compiler have been an investigation into its low level and/or interrupt
performance.  I gleefully discovered that all the nifty low level features
of Ada are supported, like code procedures and interrupt entries.

     AdaZ has two possible tasking run time modules.  One is non-preempting;
task switches occur ONLY at the synchronization points described in the LRM.
This includes interrupts!  A interrupt is deferred until a sync point.  The
manual suggests liberal use of DELAY 0.0 statements with the non-preempting
scheduler.  Yuck.

     The preempting scheduler is only marginally better.  I found to my
sorrow that standard libraries (especially Text_Io) cannot be preempted
until the operations are completed.  Time slicing, priority task switches,
AND interrupts are all deferred.  I also found out the hard way that the
scheduler makes use of the IBM PC's interrupt 28 (user clock tick routine).

     Worse yet, the preempting scheduler apparently uses floating point
calculations.  The 8087 emulation library must be bound if you don't have
a math processor.  Basic interrupt response time is 15 milliseconds on a
T1000 (4.77 MHz 8088).  This with a main task that is doing absolutely
nothing.  For comparison, a Turbo Pascal 4.0 program performing the same
function has a response time of 60 microseconds: 250 times better!  The
source program is about a quarter of the size of the Ada program, too.

     The final nail in the coffin was the observation that if back to back
interrupts occurred, the machine simply locked up.  This was with both
the nonpreempting and preempting schedulers.  Another serious annoyance was
missing optimization information for the I/O port access package, making it
impossible to optimize my test programs.  A 30K "hello world" program AFTER
optimization and dead code removal didn't do much for my mood, either.

     This is all really unfortunate, because the Ada language allows some
extremely elegant constructs for interrupt processing.  I wonder, though,
how long we are going to have to wait for low cost compilers that generate
decent code.  (I hope the big name compilers like Alsys aren't this bad.)

     I have now gone through 4 Modula 2 compilers, 2 Ada compilers, 4 Pascals,
and one each Basic, C, and C++.  The only one that I have found that is easy
to use AND generates good code is Turbo Pascal.  I have used it from the very
first 1.0 on a Z80 CP/M machine to the current 6.0 and then as now it seems
the only language useful for the moderate sized but hardware intensive work
that I do.  It allows port access and interrupts within the high level
language structure and allows inline machine code for when you really need to
get down into the muck.  The Ada language includes all these things, too, but
I have yet to find a low cost compiler that does it right.

Philip Munts N7AHL
NRA Extremist, etc.
University of Alaska, Fairbanks