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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1356f4179c1e4ef4 X-Google-Attributes: gid103376,public From: ncohen@watson.ibm.com (Norman H. Cohen) Subject: Re: ADA task Date: 1996/09/16 Message-ID: <51joib$16qc@watnews1.watson.ibm.com>#1/1 X-Deja-AN: 180921221 distribution: world references: <5174qu$o1p@nr1.ottawa.istar.net> <51cjp0$q7k@watnews1.watson.ibm.com> <323A1FF2.2781@gsde.hso.link.com> organization: IBM T.J. Watson Research Center reply-to: ncohen@watson.ibm.com newsgroups: comp.lang.ada Date: 1996-09-16T00:00:00+00:00 List-Id: In article <323A1FF2.2781@gsde.hso.link.com>, "Samuel T. Harris" writes: |> Unfortunately, Ada 83 semantics specify only that the delay |> will be at least as long as the delay. It can be more then |> the delay (possible much more). It depends on the fidelity |> of the runtime system, the desired frequency, and the load |> caused by other tasks. That is why an Ada-83 programmer should write loop delay Next_Wakeup - Calendar.Clock; Do_Some_Work; Next_Wakeup := Next_Wakeup + Interval; end loop; rather than loop delay Interval; Do_Some_Work; end loop; If one iteration takes too long, the delay in the next iteration is correspondingly shorter. Thus (assuming the system is not too overloaded to catch up), the loop executes at the desired frequency ON THE AVERAGE. Of course this is not sufficient for many real-time applications. In crucial feedback loops or in integration algorithms, one needs to know that each iteration is executed on time. This depends on the run-time system having a decent implementation of the delay statement. |> An alternative is to use passive tasks with wakeup entries |> and tie a master task to a realtime clock interrupt. |> The master task then rendevous with the passive tasks. Like the use of a delay statement, this presumes a decent run-time system, guaranteed to rendezvous promptly with passive tasks. The rules of Ada 83 (or of Ada 95 without the Real-Time Annex) don't provide any guarantees about the instantaneous resumption of the passive task (or prompt unblocking of the master task) any more than they provide guarantees about the resumption of a delayed task. One must be sure to use a decent implementation. The metrics and documentation requirements in the Ada-95 Real-Time Annex give real-time analysts the information needed to make that determination. -- Norman H. Cohen ncohen@watson.ibm.com