comp.lang.ada
 help / color / mirror / Atom feed
From: Niklas Holsti <niklas.holsti@tidorum.invalid>
Subject: Re: [Ravenscar] run tasks on events
Date: Fri, 30 May 2008 10:26:45 +0300
Date: 2008-05-30T10:26:45+03:00	[thread overview]
Message-ID: <483fabe3$0$23819$4f793bc4@news.tdc.fi> (raw)
In-Reply-To: <g1katv$b8r$1@news.lrz-muenchen.de>

Sebastian Hanigk wrote:
> Hello,
> 
> sorry if this is a stupid question, but as newcomer to Ada I've stumbled
> over the following problem: having read a bit on HAL/S which has task
> scheduling depending on signals and conditions, I'm a bit at loss how to
> implement such functionality in Ada under the Ravenscar profile (no
> dynamic task spawning).

Note that Ravenscar has other restrictions, too, which means that 
some of the answers you got are not valid:

jimmaureenrogers@worldnet.att.net wrote:
 > ...
 > You can create a task which suspends until the ascent/descent
 > phase. Simply have the task suspend on an accept statement.
 > The task will complete its execution upon execution of a
 > rendezvous associated with the accept statement.

The Ravenscar profile forbids task entries and rendezvous, so the 
above is not possible. Ravenscar tasks can be controlled only by 
protected object entries and suspension objects from 
Ada.Synchronous_Task_Control.

 >> ahab <ahabe...@gmail.com> writes:
 >>
 >>> Have the task immediately call a suspension object or a
 >>> protected entry.

Both methods work.

 > On May 29, 3:31 am, Sebastian Hanigk <han...@in.tum.de> wrote:
 >> ...
 >> Hmm, this works only for one task if I'm not mistaken (a
 >> suspension object allows only one blocking call to
 >> Suspend_Until_True at the same time...

That's right, so you would need one suspension object per task, 
whether or not the Ravenscar profile is in effect.

 >> a protected entry seems to have similar constraints).

This is true only under the Ravenscar profile, because of the 
Ravenscar restriction that Max_Entry_Queue_Length is 1. In 
unrestricted Ada, many tasks can be waiting on the same entry.

Anh Vo wrote:
 > It is not true. Protected entry, implemented in Transient
 > Signals for example, can suspend/release multiple tasks.

True in unrestricted Ada (an entry queue can hold many tasks), 
false under the Ravenscar profile (maximum one task waiting on an 
entry). If you use protected objects to trigger tasks, you need one 
object per task.

Note that under the Ravenscar profile, one generally needs one 
protected object per (sporadic) task, anyway, to trigger that task 
when required. This protected object can easily be extended with a 
boolean control variable such that the entry triggers the task only 
in the appropriate modes or phases.

On the other hand, personally I'm a bit skeptical about triggering 
certain tasks only in certain modes. I suspect that most systems 
could as well keep the same set of active tasks, and just make the 
tasks do different things in different modes, using plain old "if 
then else" in the task body.

-- 
Niklas Holsti
Tidorum Ltd
niklas holsti tidorum fi
       .      @       .



  parent reply	other threads:[~2008-05-30  7:26 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-28 19:14 [Ravenscar] run tasks on events Sebastian Hanigk
2008-05-28 23:47 ` jimmaureenrogers
2008-05-29 10:35   ` Sebastian Hanigk
2008-05-29  3:16 ` ahab
2008-05-29 10:31   ` Sebastian Hanigk
2008-05-29 18:56     ` Anh Vo
2008-05-30  6:56       ` Sebastian Hanigk
2008-05-30  7:26 ` Niklas Holsti [this message]
2008-05-30  8:57   ` [Ravenscar] " Sebastian Hanigk
2008-05-30 10:47     ` Niklas Holsti
2008-05-30 11:17       ` Sebastian Hanigk
2008-05-30 15:24         ` Alex R. Mosteo
2008-05-30 15:35           ` Ed Falis
2008-05-30 18:02             ` Sebastian Hanigk
2008-05-30 18:11               ` Ed Falis
2008-05-30 11:59       ` stefan-lucks
2008-05-30 12:17 ` jimmaureenrogers
2008-05-30 18:59   ` Sebastian Hanigk
2008-06-02 10:32     ` Alex R. Mosteo
replies disabled

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