comp.lang.ada
 help / color / mirror / Atom feed
From: FACFELD@GWUVAX.BITNET
Subject: Tasking and delays, again...
Date: 16 Feb 88 05:52:00 GMT	[thread overview]
Message-ID: <8802160554.AA17270@ajpo.sei.cmu.edu> (raw)

OK, Ada sports fans! I tried answering my own just-submitted
question with the following program. Note that A has higher
priority than B; A sleeps on (roughly) 5-second cycles and
B never explicitly sleeps at all.

I tried this on four different compilers. On
   Meridian AdaVantage 2.0 (IBM PC/AT),
   TeleSoft TeleGen2 3.13 (VAX/VMS), and
   Verdix VADS 5.41 (VAX/VMS)
Task A wrote its first message and, by several _minutes_ later,
had not written a message again. Task B got control and kept it.

On Verdix VADS 5.41 (Sun 3 Unix), A actually wrote a message
now and then, but at longer than 5-sec intervals (to be fair,
there was a lot of 1200-baud terminal I/O going on, right?).

By the way: Ada/Ed-C (IBM PC/AT) wouldn't compile the program -
some sort of "internal error" diagnostic.

So - Susan Flynn, Robert Eachus, Robert Firth, John
Goodenough, whoever: are 3 of these compilers now illegal?
If not, what ever does "preemptive scheduling" mean?
--------------------------------cut here-----------------------
with TEXT_IO, CALENDAR ; use TEXT_IO, CALENDAR;
procedure WAKEUP is
   package DURATION_IO is new FIXED_IO(DURATION);
   use DURATION_IO;

   package INT_IO is new INTEGER_IO(INTEGER);
   use INT_IO;

   task A is
      pragma PRIORITY(5);
      entry START;
   end A;

   task B is
      pragma PRIORITY(2);
      entry START;
   end B;

   task body A is
      begin
         accept START;
         loop
            PUT("********TASK A HERE"); PUT(SECONDS(CLOCK)); NEW_LINE;
            delay 5.0;
         end loop;
      end A;

   task body B is
      begin
         accept START;
         loop
            PUT("TASK B HERE"); PUT(SECONDS(CLOCK)); NEW_LINE;
            --delay 5.0;
         end loop;
      end B;


begin -- MAIN
  A.START;
  B.START;
end WAKEUP;

             reply	other threads:[~1988-02-16  5:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1988-02-16  5:52 FACFELD [this message]
  -- strict thread matches above, loose matches on Subject: below --
1988-02-16 15:47 tasking and delays, again John.Goodenough
1988-02-16  4:40 Tasking " Mike Feldman
1988-02-26 21:40 ` Barnacle Wes
replies disabled

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