comp.lang.ada
 help / color / mirror / Atom feed
* Re: ADA task
@ 1996-09-17  0:00 Marin David Condic, 407.796.8997, M/S 731-93
  1996-09-20  0:00 ` Robert A Duff
  0 siblings, 1 reply; 19+ messages in thread
From: Marin David Condic, 407.796.8997, M/S 731-93 @ 1996-09-17  0:00 UTC (permalink / raw)



Robert Dewar <dewar@CS.NYU.EDU> writes:
>This is true from a formal point of view, but any decent Ada 83 compiler
>that has any pretense to being usable for real time or simulation
>purposes using tasking should provide an effective delay implementation
>corresponding to the Ada 95 semantics.
>
    Yes, but as I alluded to in an earlier post, there was (is?) a
    problem with Ada83 delay semantics - at least from a "pure Ada"
    viewpoint. (Any given implementation may not have exhibited the
    problem, but you couldn't know that it *wouldn't* just from
    language semantics.) Consider this:

       task Cyclic_Processor;

       task body Cyclic_Processor is
          INTERVAL    : constant Duration := 0.050;
          NEXT        : Time := Calendar.Clock + INTERVAL ;
          TEMP        : Duration := INTERVAL;
       begin
          loop
             TEMP := Next - Calendar.Clock;
             delay TEMP;
             Do_Some_Work;
             Next := Next + INTERVAL;
          end loop;
       end Cyclic_Processor;

    I borrowed & modified this example from the Ada83 LRM (Section
    9.6) and added a temporary variable to illustrate a point: The
    computation of "Next - Calendar.Clock" is not "atomic". It could
    be interrupted by a higher priority task after sampling
    Calendar.Clock and before performing the subtraction. (not real
    likely, but it _could_ happen, eh?) If the task remains suspended
    for a small amount of time, you get jitter. If it is a relatively
    large amount of time, you will start missing cycles.

    I don't know if the "delay until" semantics of Ada95 guarantees
    any better predictability, but it at least eliminates the sampling
    of Calendar.Clock for computing when the next cycle should happen
    and (presumably) it's easier for the runtime environment to
    provide uninterruptability where needed and likely provide a
    "fixed" error between the requested wakeup and the actual wakeup.
    Given a static, constant computation of Next := Next + INTERVAL;
    it would be a lot easier for Ada95 to give you what you want.

    Correct me if I'm wrong on this. I believe this was a problem with
    Ada83 which needed correcting specifically because implementations
    had a hard time providing behavior which could be guaranteed to be
    predictable given the semantics of the language.

    MDC
Marin David Condic, Senior Computer Engineer    ATT:        561.796.8997
M/S 731-96                                      Technet:    796.8997
Pratt & Whitney, GESP                           Fax:        561.796.4669
P.O. Box 109600                                 Internet:   CONDICMA@PWFL.COM
West Palm Beach, FL 33410-9600                  Internet:   CONDIC@FLINET.COM
===============================================================================
   "Don't say yes until I finish talking."

        -- Darryl F. Zanuck
===============================================================================




^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: ADA task
@ 1996-09-18  0:00 tmoran
  0 siblings, 0 replies; 19+ messages in thread
From: tmoran @ 1996-09-18  0:00 UTC (permalink / raw)



> This depends on the run-time system having a decent implementation
> of the delay statement.
  What is an indecent implementation?  They all have to wait for
higher priority tasks, and the race condition can happen to any Ada 83
system, so what else can go wrong?  Slow code?  Slow OS?
  On the MS-Intel platforms, the OS is the main impediment, with a
very large clock'tick and a very slow Calendar.Clock call.  That
could be easily fixed in DOS, but not in modern MS OSes.




^ permalink raw reply	[flat|nested] 19+ messages in thread
* Re: ADA task
@ 1996-09-17  0:00 Marin David Condic, 407.796.8997, M/S 731-93
  1996-09-19  0:00 ` Norman H. Cohen
  0 siblings, 1 reply; 19+ messages in thread
From: Marin David Condic, 407.796.8997, M/S 731-93 @ 1996-09-17  0:00 UTC (permalink / raw)



"Norman H. Cohen" <ncohen@WATSON.IBM.COM> writes:
>The "delay until" statement is a new feature in Ada 95.  In Ada 83 you
>would write
>
>   delay Next_Wakeup - Calendar.Clock;
>
>which delays for the specified amount of time (in this case, the time
>from now until Next_Wakeup).
>
    Out of curiosity & ignorance, is there anything in the LRM which
    guarantees some minimal latency or predictability with the "delay
    until" statement? I recall one of the big criticisms of Ada83 was
    that the "delay" statement (and other language semantics) made it
    very difficult, if not impossible, to write a task which could
    schedule itself in a predictable manner. (That is, if one wanted
    to fire off a task every 20 milliseconds, one would like to know
    that any fraction of scheduling error is detected and corrected in
    the next pass to the limit of the accuracy of the clock and that,
    if at all possible, you get no "jitter" in the interval between
    cycles.)

    MDC

Marin David Condic, Senior Computer Engineer    ATT:        561.796.8997
M/S 731-96                                      Technet:    796.8997
Pratt & Whitney, GESP                           Fax:        561.796.4669
P.O. Box 109600                                 Internet:   CONDICMA@PWFL.COM
West Palm Beach, FL 33410-9600                  Internet:   CONDIC@FLINET.COM
===============================================================================
   "Don't say yes until I finish talking."

        -- Darryl F. Zanuck
===============================================================================




^ permalink raw reply	[flat|nested] 19+ messages in thread
* ADA task
@ 1996-09-11  0:00 Roumen Roupski
  1996-09-12  0:00 ` Philip Brashear
  1996-09-13  0:00 ` Norman H. Cohen
  0 siblings, 2 replies; 19+ messages in thread
From: Roumen Roupski @ 1996-09-11  0:00 UTC (permalink / raw)



Hi

I am new in ADA programming and I use GNAT Ada version 3.04a for Windows
NT.  I have got couple of questions about "tasking" in ADA.

1. How can I implement a task running at regular intervals, for example
every 50ms +/- 5ms. The task activation must be guaranteed too.

2. What is overhead of running an ADA task, memory usage, task creation
time, and task-switching overhead? Is there any practical limit for maximum
number of simultaneously running tasks?

Regards,
Roumen Roupski

Pika Technologies Inc.
Roumen.Roupski@Pika.Ca




^ permalink raw reply	[flat|nested] 19+ messages in thread

end of thread, other threads:[~1996-09-20  0:00 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1996-09-17  0:00 ADA task Marin David Condic, 407.796.8997, M/S 731-93
1996-09-20  0:00 ` Robert A Duff
  -- strict thread matches above, loose matches on Subject: below --
1996-09-18  0:00 tmoran
1996-09-17  0:00 Marin David Condic, 407.796.8997, M/S 731-93
1996-09-19  0:00 ` Norman H. Cohen
1996-09-20  0:00   ` Robert A Duff
1996-09-11  0:00 Roumen Roupski
1996-09-12  0:00 ` Philip Brashear
1996-09-13  0:00 ` Norman H. Cohen
1996-09-13  0:00   ` Samuel T. Harris
1996-09-14  0:00     ` Robert Dewar
1996-09-14  0:00       ` Samuel T. Harris
1996-09-15  0:00         ` David C. Hoos, Sr.
1996-09-16  0:00           ` Samuel T. Harris
1996-09-16  0:00     ` Norman H. Cohen
1996-09-14  0:00   ` Ken Garlington
1996-09-14  0:00   ` Roumen Roupski
1996-09-16  0:00     ` Norman H. Cohen
1996-09-16  0:00   ` Robert I. Eachus

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