comp.lang.ada
 help / color / mirror / Atom feed
From: l_mathias@hotmail.com (Mathias)
Subject: Ceiling priority and priority inversion
Date: 2 Sep 2002 08:07:21 -0700
Date: 2002-09-02T15:07:21+00:00	[thread overview]
Message-ID: <9b051957.0209020707.562bdac4@posting.google.com> (raw)

I an pretty new with Ada and wonder if someone out there can help me clarify
how the pragma Locking_Policy(Ceiling_Priority) works.

To prevent priority inversion when multiple tasks simultaneously access a
protected object you should apply the pragma
Locking_Policy(Ceiling_Priority).

As I interpret the book "Concurrency in Ada" by Burns and Wellings it works
as follows:
The effect of the pragma Locking_Policy(Ceiling_Priority) is that all tasks
accessing subroutines in a protected object execute these with the ceiling
priority. If you omit the pragma Priority in the protected object, the
compiler assigns the ceiling priority of the protected object to the highest
priority defined for the system.

Let's say for an example that the protected object is a buffer shared
between a number of tasks, among which one is a  low priority application
task and another is an interrupt handler. Using Ceiling_Priority will cause
all tasks executing within the protected object do so with interrupt
priority. Doesn't this potentially cause a kind of priority inversion? When
the application task executes within the buffer it preempts all other tasks
in the system, even interrupts.

Shouldn't it instead work like the following? If a low priority task is
executing within a protected object and a task with a higher priority tries
to gain access this object. Then the low priority task should be raised to
the priority level of the waiting task. But if there is no concurrent access
the low priority task executes with its base priority.


Thanks for any help

/Mathias Larsson



             reply	other threads:[~2002-09-02 15:07 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-09-02 15:07 Mathias [this message]
2002-09-02 15:51 ` Ceiling priority and priority inversion Pat Rogers
2002-09-02 16:26 ` Jim Rogers
replies disabled

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