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,FROM_ADDR_WS autolearn=no autolearn_force=no version=3.4.5-pre1 Date: 17 Sep 92 14:26:43 GMT From: cis.ohio-state.edu!news.sei.cmu.edu!firth@ucbvax.Berkeley.EDU (Robert Fi rth) Subject: Re: Ada delay Message-ID: <1992Sep17.142643.21378@sei.cmu.edu> 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). Either a list is ordered or you have to search it, but not both, surely, else somebody has it in the wrong order. The usual way is to keep a list of delayed tasks ordered by wake-up time. You organise the list so that inserting a new task is efficient, and then set the timer to the wake-up time of the first task. When the timer goes off, you pull the first task off the list and stuff it in the ready queue, reset the timer for the next task, and exit to the scheduler. For Ada, you need three efficient primitives . insert in correct place in ordered list . remove first in list . remove named task from list (for conditional entry and accept) Not hard.