comp.lang.ada
 help / color / mirror / Atom feed
From: "Samuel A. Mize" <smize@magellan.bgm.link.com>
To: scott@tcville.es.hac.com
Subject: Re: Policies In Ada
Date: 1997/05/20
Date: 1997-05-20T00:00:00+00:00	[thread overview]
Message-ID: <3381BCFB.167E@magellan.bgm.link.com> (raw)
In-Reply-To: 5lqke4$dkv@hacgate2.hac.com


scott@tcville.es.hac.com wrote:
> 
> In article 190000c2@Stephen.ers.ie, "Stephen Cox" <stephen@ers.ie> () writes:
> >Also, I have implemented two tasks with the same priority i.e. they both
> >have pragma priority(0); in their declaration yet only the first task seems
> >to execute. Any ideas?
> 
> This could be a feature of your OS.

This depends on whether Stephen is using Ada 83 or 95, and
if Ada 95 on whether it supports Annex D.

** Assuming Stephen is using Ada 95 with support for Annex D **
it's a feature of the default task dispatching policy
("FIFO_Within_Priorities").  Tasks run until they hit a
"task dispatching point" -- a same-priority task CAN'T
interrupt the current task.  To get time-slicing, you must
use a Task_Dispatching_Policy pragma (AND the compiler
must support a time-slicing policy, which is not required).

Task dispatching points include delay statements (including a
delay 0.0), completion of an accept statement, when a
higher-priority task becomes ready -- these are examples,
there are others.  If your tasks are loops, you can put a
"delay 0.0" into both loops, and they should both get to run.

But don't just take this as a cookbook approach -- read and
understand ARM section D.2.

** If it's an Ada 95 compiler but doesn't support Annex D **
you get pot luck for task dispatching policy.  However,
FIFO_Within_Priorities is still likely because it's easier
to build than time-slicing.

** For Ada 83 **
I don't remember the rules for same-priority tasks (if any).

Samuel Mize

--
-- Samuel Mize           (817) 619-8622               "Team Ada"
-- Hughes Training Inc.  PO Box 6171 m/s 400, Arlington TX 76005




  reply	other threads:[~1997-05-20  0:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-05-07  0:00 Policies In Ada Stephen Cox
1997-05-08  0:00 ` Robert Dewar
1997-05-19  0:00 ` scott
1997-05-20  0:00   ` Samuel A. Mize [this message]
1997-05-25  0:00     ` Robert Dewar
replies disabled

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