comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Creem <jeff@thecreems.com>
Subject: Re: Task Scheduling
Date: Sun, 07 Jan 2007 15:47:38 -0500
Date: 2007-01-07T15:47:38-05:00	[thread overview]
Message-ID: <7s2874-opb.ln1@newserver.thecreems.com> (raw)
In-Reply-To: <mailman.13.1168180123.18371.comp.lang.ada@ada-france.org>

  jpluto wrote:
> 
> 
> A questions please:
> 
> I am trying to solve a problem, and I am not sure how to code it.
> 
> For example, if I have three arbitrary tasks, task1 has a priority than 
> task2.
> Therefore, task1 will always preempt task2 and task3.
> 
> However, if task2 ran first and locked a shared data resource that is 
> shared with ONLY task3 and NOT task1.  Then if task1 arrives, I want 
> task1 to yield the processor to task2 until task2 is finished using the 
> resource even though task1 has the highest priority.
> 
> The problem, task1 has a higher priority and does NOT use this shared 
> resource.
> How can I ask this task1 not to run, and to wait whenever this shared 
> resource is locked by task2 or task3?

I can't really think of a way. What you are asking for really seems 
quite odd and seems like a very strange way to abuse the priority system.

It sounds like what you 'really' want to do is to have dynamic 
priorities on tasks 2 and 3 such that whenever they 'have' the shared 
resource, they elevate their priority higher than task 1.

Have you considered just building the code that controls access to the 
resource such that it uses Ada.Dynamic_Priorities to capture initial 
priority, raise it up while the resource is held and then restore it 
when the resource is done....Or something like that?



      parent reply	other threads:[~2007-01-07 20:47 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-07 14:28 Task Scheduling   jpluto
2007-01-07 14:49 ` Ludovic Brenta
2007-01-07 20:47 ` Jeffrey Creem [this message]
replies disabled

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