comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Arguments for single-mutex-exclusion on protected types (Was: Does Ada tasking profit from multi-core cpus?)
Date: Mon, 19 Mar 2007 16:49:12 -0500
Date: 2007-03-19T16:49:12-05:00	[thread overview]
Message-ID: <etn0dq$i5n$1@jacob-sparre.dk> (raw)
In-Reply-To: wccmz2azb7j.fsf@shell01.TheWorld.com

"Robert A Duff" <bobduff@shell01.TheWorld.com> wrote in message
news:wccmz2azb7j.fsf@shell01.TheWorld.com...
> "Randy Brukardt" <randy@rrsoftware.com> writes:
>
> > I don't understand Jeffrey's point either, but isn't it true that
ceiling
> > locking is essentially irrelevant on multiprocessor systems? That is,
the
> > point is to get rid of the lock, but you can't do that on a
multi-processor
> > (one processor can be running a lower priority task without anything
being
> > wrong, and that task had better be blocked from accessing the protected
> > object). So ceiling locking has no advantage on a multi processor, it
just
> > restricts what you can do. If multiple cores continue to grow in
popularity,
> > it seems that the whole ceiling locking thing will become essentially
> > irrelevant - just another case of premature optimization.
> >
> > (Can you tell I don't like ceiling locking much??)
>
> On a multiprocessor, you can use ceilings plus spin locks to protect
> protected objects.  The point is to avoid any queued waiting to enter a
> PO (all the queuing is done with entry queues in this model).  That can
> be made quite efficient, and the ceilings still prevent certain forms of
> priority inversion.  So, no, I don't think ceilings are entirely
> irrelevant on multiprocessors.

I believe that latter point (ceiling prevent some forms of priority
inversion, because they boost the priority of everything in the PO), but I
don't see the former. I don't see any reason that you would have to use a
queued (rather than a spin) lock with or without ceiling locking. Until you
have the spin lock, your priority doesn't matter (if you get pre-empted, so
what?). And afterwards, it's just a special case of the normal potential
priority inversion of a PO: if it isn't an issue for the entire object
(assuming you can start a protected action), it surely won't matter how you
start that action.

The problem with ceiling locking is that it depends on boosting the priority
of tasks. That means its a big problem for longer-running operations (such
as I/O, which aren't allowed in protected operations for this reason). And
it's a big problem for reusable libraries, which can't know ahead of time
what the ceiling ought to be. (Make it too high, and critical tasks could be
starved by lower-priority ones operating in the library, make it too low and
tasks aren't even allowed to access the library.) Consider trying to set the
ceiling for a container library implemented with protected objects. (At
least we now can do this on the fly; in Ada 95, it was impossible.)

> Ceilings are largely irrelevant if you're building Ada tasking on top of
> some other system (posix or windows threads, for example) that wants to
> do things differently.  I mean, if you're using the
> one-Ada-task-per-thread model.

Is there any other kind? I haven't heard of many bare-machine Ada projects
in recent years; almost everything is on top of some sort of RTOS or other
OS. (That's too bad, really, for a lot of projects, Ada provides nearly
everything you need in an RTOS.)

> Another issue is that Ada's priority model has nothing to say about
> processor affinity.

True enough, but I don't think most OSes have much to say on this topic,
either. That makes it pretty hard to say anything about it (unless you use a
one-thread for all tasks model -- but that's a pessimising implementation!)

                                    Randy.





  reply	other threads:[~2007-03-19 21:49 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-01-29 11:57 Does Ada tasking profit from multi-core cpus? Gerd
2007-01-29 12:04 ` Georg Bauhaus
2007-01-30 13:55   ` Gerd
2007-02-09 10:18     ` karl
2007-02-09 11:03       ` Stefan Lucks
2007-02-09 11:35         ` Ludovic Brenta
2007-03-04 17:54 `   jpluto
2007-03-05 10:08   ` Ludovic Brenta
2007-03-05 13:12     ` Dmitry A. Kazakov
2007-03-06  5:33       ` tmoran
2007-03-06  8:44         ` Dmitry A. Kazakov
2007-03-07  7:52           ` tmoran
2007-03-07  9:31           ` tmoran
2007-03-06  9:40         ` Colin Paul Gloster
2007-03-06 12:47           ` Jeffrey Creem
2007-03-06 14:44           ` Georg Bauhaus
2007-03-06 16:53         ` Dr. Adrian Wrigley
2007-03-06 18:58           ` tmoran
2007-03-07 10:11             ` Colin Paul Gloster
2007-03-07 18:47               ` tmoran
2007-03-06 18:51         ` Jeffrey R. Carter
2007-03-16 14:29           ` Arguments for single-mutex-exclusion on protected types (Was: Does Ada tasking profit from multi-core cpus?) Jacob Sparre Andersen
2007-03-17  5:26             ` Jeffrey R. Carter
2007-03-17 17:22               ` Robert A Duff
2007-03-17 17:52                 ` Jeffrey R. Carter
2007-03-17 23:06                 ` Randy Brukardt
2007-03-18 17:57                   ` Robert A Duff
2007-03-19 21:49                     ` Randy Brukardt [this message]
2007-03-20  0:55                       ` Jeffrey R. Carter
2007-03-20  1:36                         ` Randy Brukardt
2007-03-20 16:32                           ` Jeffrey R. Carter
2007-03-20 17:51                             ` Randy Brukardt
2007-03-21  0:10                               ` Jeffrey R. Carter
2007-03-26 23:38                               ` Robert A Duff
2007-03-26 23:24                           ` Robert A Duff
2007-03-17 10:25             ` Dmitry A. Kazakov
2007-03-18 17:15               ` Arguments for single-mutex-exclusion on protected types Jacob Sparre Andersen
2007-03-18 18:50                 ` Dmitry A. Kazakov
2007-03-20 12:38                 ` Florian Weimer
2007-03-07  3:58       ` Does Ada tasking profit from multi-core cpus? Steve
2007-03-07  8:39         ` Dmitry A. Kazakov
2007-03-08  5:21           ` Randy Brukardt
2007-03-08 10:15             ` Dmitry A. Kazakov
2007-03-08 21:18               ` accuracy (was: Does Ada tasking profit from multi-core cpus?) Björn Persson
2007-03-09  8:33                 ` accuracy Dmitry A. Kazakov
2007-03-10  1:39                   ` accuracy Randy Brukardt
2007-03-10  9:11                     ` accuracy Dmitry A. Kazakov
2007-03-11  3:03                       ` accuracy Randy Brukardt
2007-03-11  5:21                         ` accuracy tmoran
2007-03-11  8:52                         ` accuracy Dmitry A. Kazakov
2007-03-11 13:57                           ` accuracy Pascal Obry
2007-03-11 14:16                             ` accuracy Dmitry A. Kazakov
2007-03-11 14:37                               ` accuracy Pascal Obry
2007-03-11 15:50                                 ` accuracy Dmitry A. Kazakov
2007-03-11 17:38                                   ` accuracy Pascal Obry
2007-03-11 18:48                                     ` accuracy Dmitry A. Kazakov
2007-03-12 20:20                           ` accuracy Randy Brukardt
2007-03-13  9:33                             ` accuracy Dmitry A. Kazakov
2007-03-10 14:53                     ` accuracy Stephen Leake
2007-03-10 18:36                       ` accuracy Cesar Rabak
2007-03-05 18:46   ` Does Ada tasking profit from multi-core cpus? Jeffrey R. Carter
replies disabled

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