From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,96fc7f1e397aab8,start X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-02 08:07:21 PST Path: archiver1.google.com!postnews1.google.com!not-for-mail From: l_mathias@hotmail.com (Mathias) Newsgroups: comp.lang.ada Subject: Ceiling priority and priority inversion Date: 2 Sep 2002 08:07:21 -0700 Organization: http://groups.google.com/ Message-ID: <9b051957.0209020707.562bdac4@posting.google.com> NNTP-Posting-Host: 146.75.247.241 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1030979241 5457 127.0.0.1 (2 Sep 2002 15:07:21 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 2 Sep 2002 15:07:21 GMT Xref: archiver1.google.com comp.lang.ada:28654 Date: 2002-09-02T15:07:21+00:00 List-Id: 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