comp.lang.ada
 help / color / mirror / Atom feed
From: cis.ohio-state.edu!news.sei.cmu.edu!firth@ucbvax.Berkeley.EDU  (Robert Fi
Subject: Re: Ada delay
Date: 17 Sep 92 14:26:43 GMT	[thread overview]
Message-ID: <1992Sep17.142643.21378@sei.cmu.edu> (raw)

In article <Buq4Mr.D7H@math.uwaterloo.ca> 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.

             reply	other threads:[~1992-09-17 14:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1992-09-17 14:26 cis.ohio-state.edu!news.sei.cmu.edu!firth [this message]
  -- strict thread matches above, loose matches on Subject: below --
1992-09-17 15:04 Ada delay Jorge Luis Diaz-Herrera
1992-09-17 17:45 Bob Kitzberger
1992-09-18  1:11 mcsun!uknet!yorkohm!minster!ken
1992-09-18  9:05 Guangxing Li
1992-09-19 17:56 Gary Funck
1992-09-21  2:40 H.Shrikumar{shri@ncst.in}
1992-09-21 13:43 John Goodenough
replies disabled

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