From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.5-pre1 (2020-06-20) on ip-172-31-74-118.ec2.internal X-Spam-Level: X-Spam-Status: No, score=-0.9 required=3.0 tests=BAYES_00,TO_NO_BRKTS_PCNT autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 19 Sep 92 17:56:45 GMT From: mcsun!sunic!psinntp!psinntp!intrepid!gary@uunet.uu.net (Gary Funck) Subject: Re: Ada delay Message-ID: <1992Sep19.175645.10076@intrepid.com> List-Id: In article amichail@plg.uwaterloo.ca (Amir Micha il) writes: >How is the Ada delay statement implemented? I suppose it uses a hardware >timer coupled with a clock server, but this would mean that the time >taken for a delay is unbounded (since we have to search an ordered list >of tasks). If this is true, then how can one possibly use it for >realtime scheduling of periodic tasks?? > Amir, Your note brings up a few issues: - "unbounded" may not be quite correct. Searching a linear list and making a task ready to run is linear with respect to the number of tasks in the delay queue. - Some implementations use either a timer that is periodic (interrupts at fixed time intervals) or an "interval timer" that whose time delta is reprogrammed to the delta of the next task waiting in the delay queue. The periodic timer generally has less skew, but places a consistent and sometimes heavy load on the system, if the time granularity is small. Overheads to due to processinmg periodic timer interrupts can be in the neighborhood of 10-15%, if the time period is in the neighborhood of 1 KHz, for example. - The Ada language specifies that a task delay must be *no less than* than the requested time delay. An implementation can meet the letter of law, by processing delay requests, only at language defined preemption points. Most "modern" Ada runtimes support task preemption at arbitrary ppints in the execution of a task; some older ones only checked when an Ada program performed a tasking operation, leading to tryly unbounded delays. - In practice, applications that require tight time synchronization attach an Ada interrupt entry to an interrupt tied to a periodic timer, sometimes called the "frame generator". If the context switch from interrupt level to task level takes too long, some applications do the bulk of the periodic processing at interrupt level, defining an interrupt service routine. The facilities for handling events directly at interrupt level are vendor specific. For example, Verdix has something called "passive interrupt tasks" that give you the syntax of tasks, and most of the efficiency of interrupt service routines. - Ada 9X includes something called the "real-time annex" to the language definition that is directed at solving some of the known problems with using Ada in a real-time environment. -- | Gary Funck gary@intrepid.com [uunet!uupsi!intrepid!gary] | Intrepid Technology Inc., Mountain View CA (415) 964-8135 --