comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <spam@spam.com>
Subject: Re: Problem with -gnatt
Date: Sun, 24 Oct 2004 05:45:06 GMT
Date: 2004-10-24T05:45:06+00:00	[thread overview]
Message-ID: <CjHed.5478$KJ6.2626@newsread1.news.pas.earthlink.net> (raw)
In-Reply-To: <sa4ekjqt0bw.fsf@snoopy.apana.org.au>

Brian May wrote:
> 
> However, as I think I might have said before, I have read that
> creating a semaphore using a protected type is inefficient, because
> protected types where intended to be much more flexible then
> semaphores.

There are places where semaphores are required. One is when exclusive 
control of external resources is required, and different combinations of 
such resources are required in different circumstances. Special 
attention to the order of obtaining and releasing such resources is 
needed to avoid deadlock.

There are three ways to deal with mutual exclusion: semaphores, 
protected objects, and passive tasks. Semaphores should be avoided when 
possible. Passive tasks, the main idiom in Ada 83, have the advantages 
of protected objects without the disadvantages. Potentially blocking 
operations may be made from critical regions in passive tasks, for 
example. The disadvantage of passive tasks is that they are tasks, and 
each operation requires a context switch.

There are places where each approach is preferable.

Note that compilers implementing Annex D provide the package 
Ada.Synchronous_Task_Control, which defines type Suspension_Object, 
which is essentially a binary semaphore (D.10), probably implemented 
more efficiently than using a protected object.

-- 
Jeff Carter
"You've got the brain of a four-year-old boy,
and I bet he was glad to get rid of it."
Horse Feathers
47




  reply	other threads:[~2004-10-24  5:45 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-07 10:40 Javadoc-like for Ada Alex R. Mosteo
2004-10-07 11:46 ` stephane richard
2004-10-07 13:05   ` Marc A. Criley
2004-10-07 13:39     ` Alex R. Mosteo
2004-10-07 16:51       ` Problem with -gnatt (was Re: Javadoc-like for Ada) Alex R. Mosteo
2004-10-07 18:43         ` Marc A. Criley
2004-10-07 20:07           ` Björn Persson
2004-10-08  8:40           ` Alex R. Mosteo
2004-10-07 19:21         ` Problem with -gnatt Ludovic Brenta
2004-10-08  8:45           ` Alex R. Mosteo
2004-10-08  9:43             ` Martin Dowie
2004-10-08 13:09               ` Alex R. Mosteo
2004-10-09 14:17                 ` Stephen Leake
2004-10-15 20:11                   ` Matthew Heaney
2004-10-18  7:59                     ` Alex R. Mosteo
2004-10-08 16:52             ` Ludovic Brenta
2004-10-09 14:16             ` Stephen Leake
2004-10-09 14:45               ` Jeff C r e e.m
2004-10-10 12:25                 ` Ludovic Brenta
2004-10-10 14:42                 ` Stephen Leake
2004-10-15 20:03               ` Matthew Heaney
2004-10-16 13:16                 ` Stephen Leake
2004-10-15 20:00             ` Matthew Heaney
2004-10-15 20:06             ` Matthew Heaney
2004-10-18  7:59               ` Alex R. Mosteo
2004-10-18 16:48                 ` Matthew Heaney
2004-10-18 18:21                   ` Alex R. Mosteo
2004-10-19  0:20                     ` Matthew Heaney
2004-10-19  2:41                       ` Brian May
2004-10-19  3:08                         ` Matthew Heaney
2004-10-19  7:15                           ` Alex R. Mosteo
2004-10-19 14:52                             ` Matthew Heaney
2004-10-19 15:46                               ` Alex R. Mosteo
2004-10-19 20:03                                 ` Matthew Heaney
2004-10-19 20:38                                   ` Alex R. Mosteo
2004-10-23  6:28                                   ` Brian May
2004-10-24  5:45                                     ` Jeffrey Carter [this message]
2004-10-24  8:54                                       ` Dmitry A. Kazakov
2004-10-20  1:20                         ` Jeffrey Carter
2004-10-20 14:48                           ` Matthew Heaney
2004-10-19  7:36                       ` Alex R. Mosteo
2004-10-20  5:19                         ` Simon Wright
2004-10-20  7:59                           ` Alex R. Mosteo
2004-10-11 22:53 ` Javadoc-like for Ada Lionel Draghi
  -- strict thread matches above, loose matches on Subject: below --
2004-10-20  1:34 Problem with -gnatt Stephen Leake
2004-10-20  6:37 ` Matthew Heaney
2004-10-20  9:19 ` Pascal Obry
2004-10-20 13:22 Stephen Leake
2004-10-20 15:08 ` Pascal Obry
2004-10-20 16:23   ` Alex R. Mosteo
2004-10-20 16:38     ` Pascal Obry
2004-10-20 20:05       ` Alex R. Mosteo
2004-10-23 20:12       ` Niklas Holsti
replies disabled

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