From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!utgpu!water!watmath!clyde!rutgers!rochester!ur-tut!sunybcs!boulder!hao!ames!pasteur!ucbvax!GWUVAX.BITNET!FACFELD From: FACFELD@GWUVAX.BITNET Newsgroups: comp.lang.ada Subject: Tasking and delays, again... Message-ID: <8802160554.AA17270@ajpo.sei.cmu.edu> Date: 16 Feb 88 05:52:00 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: 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;