comp.lang.ada
 help / color / mirror / Atom feed
From: Ted Dennison <dennison@telepath.com>
Subject: Re: Duration vs. Ada.Real_Time
Date: Wed, 31 Jan 2001 16:03:32 GMT
Date: 2001-01-31T16:03:32+00:00	[thread overview]
Message-ID: <959d0c$gsg$1@nnrp1.deja.com> (raw)
In-Reply-To: uk87d9kjh.fsf@gsfc.nasa.gov

In article <uk87d9kjh.fsf@gsfc.nasa.gov>,
  Stephen Leake <stephen.a.leake.1@gsfc.nasa.gov> wrote:

> Perhaps it would be more appropriate for Marin to request that type
> Ada.Real_Time.Time_Span (LRM appendix D) match the hardware clock;
> that is more clearly intended to be a "hard real-time" clock type.

OK. I've tried to just say "its not that simple". Since no one seems to
be accepting that, let's look at this suggestion in detail. Let's
postulate a PC system, since that's the most common one in use.

The PC system has 3 built-in timing methods. The first is the
"Real-Time" clock, which is usually used to drive OS scheduling
operations. This is essentially the 8253 timer chip, which divides
4.77272MHz signals from the processor (I'm not sure if this is standard,
or varies depending on the processor or bus speed. I'm also not sure if
its exact, or an approxmiation) into some convienent number of RTC
interrupts (like by 65536 to produce interrupts at 18.20648Hz).
However, it is possible for software to change this amount. Thus, if an
Ada compiler were to use "the units of the clock" for this clock, it
would have to use either some huge number in units of 4.77272 x 10^^-6
(or whatever the particular system uses for its base), or it would have
to somehow dynamcily pick the units that the RTC happens to be spewing
out at the moment (and be ready to change if software changes it).
However, the OS most likely uses its own approximation for these units,
so the compiler would have to approxmiate whenever passing control to
the OS for actual scheduling.

There is also a "time of day" clock that just keeps a counter in memory.
For most Ada compilers this clock will only be accessed through OS
system calls. Whatever units the OS uses would be OK here.

There is also a high-frequency timer. This also just keeps a counter in
memory. However in this case it is the CPU doing it, and the counter
increments by one each time the CPU cycles. Thus its rate is dependent
on the clock rate of the CPU. It is possible to set up interrupts when
the counter reaches a (software-set) value. Thus this could be used, but
the Ada compiler would then have to pick units that match the processor
clock speed (which would probably not match any of the above).

Short answer: its not that simple.

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com
http://www.deja.com/



  parent reply	other threads:[~2001-01-31 16:03 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <980495512.529981@edh3>
     [not found] ` <8mac6.9236$R5.473526@news1.frmt1.sfba.home.com>
2001-01-26 15:30   ` Duration vs. Ada.Real_Time Robert Dewar
     [not found] ` <3A71814B.7E8CCF60@acm.org>
2001-01-26 15:33   ` Robert Dewar
2001-01-26 20:58     ` Marin David Condic
2001-01-26 21:32       ` Ted Dennison
2001-01-27  5:01         ` Keith Thompson
2001-01-27 14:40           ` Marin David Condic
2001-01-27 14:34         ` Marin David Condic
2001-01-28  0:18           ` Robert Dewar
2001-01-29 14:54           ` Ted Dennison
2001-01-29 18:40             ` Marin David Condic
2001-02-08  3:32               ` Buz Cory
2001-02-08 15:34                 ` Marin David Condic
2001-02-10  3:08                   ` Steve Whalen
2001-01-28  0:13       ` Robert Dewar
2001-01-29 14:02         ` Marin David Condic
2001-01-30 14:33         ` Stephen Leake
2001-01-31 14:55           ` Marin David Condic
2001-01-31 16:03           ` Ted Dennison [this message]
2001-01-31 19:16             ` Marin David Condic
2001-01-31 20:53               ` Ted Dennison
2001-01-31 21:30                 ` tmoran
2001-01-31 21:47                 ` Marin David Condic
2001-02-01 14:18                   ` Ted Dennison
2001-01-28 19:32 ` Simon Wright
2001-01-31  6:13   ` Robert Dewar
2001-01-31 15:07     ` Marin David Condic
2001-02-01  5:43       ` Robert Dewar
2001-01-31  5:51 Christoph Grein
2001-02-01  6:27 ` Simon Wright
replies disabled

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