From: Jeffrey Carter <jrcarter@acm.org>
Subject: Re: new_line in a put_line
Date: Wed, 04 Dec 2002 16:55:20 GMT
Date: 2002-12-04T16:55:20+00:00 [thread overview]
Message-ID: <3DEE33A5.8080709@acm.org> (raw)
In-Reply-To: uznrlergk.fsf@nasa.gov
Stephen Leake wrote:
>
> Assuming Lock is a controlled type, that releases the lock in
> Finalize, this [using a semaphore] is an excellent design.
I would disagree. Using a high-level feature such as a protected type to
implement a low-level construct such as a semaphore is abstraction
inversion. Ada has high-level concurrency features, and it should be
possible to solve this problem directly in terms of those features.
Using a semaphore probably indicates a lack of familiarity with those
features rather than a reasoned decision that a semaphore is the best
solution.
For a real-time system I designed a debug-output system based on a
protected bounded queue of bounded strings with a very high ceiling
priority (any task could make a debug-output call) and a task with a
very low priority (it only ran when nothing else was running) to
actually do the output. Some logic deleted the oldest message in the
queue if new messages were added when the queue was full, though that
never happened in practice. The idea was that calls to produce output
never blocked the caller so the system had minimal impact on the timing
of the system.
Of course, that had more complex requirements than what is being
discussed here. Apparently the OP doesn't mind if the tasks are blocked
during output, so simply rendezvousing with a task that does the output
would solve the problem and be simpler and clearer than the semaphore +
protected type approach.
--
Jeff Carter
"Go and boil your bottoms."
Monty Python & the Holy Grail
next prev parent reply other threads:[~2002-12-04 16:55 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-12-02 5:36 new_line in a put_line Vlad
2002-12-02 9:47 ` Preben Randhol
2002-12-02 17:04 ` Frank J. Lhota
2002-12-05 11:10 ` Preben Randhol
2002-12-02 10:14 ` Dmitry A. Kazakov
2002-12-02 14:57 ` Matthew Heaney
2002-12-03 11:33 ` Fraser Wilson
2002-12-03 15:01 ` Dmitry A. Kazakov
2002-12-04 9:31 ` Fraser Wilson
2002-12-04 14:10 ` Dmitry A. Kazakov
2002-12-04 15:23 ` Robert A Duff
2002-12-04 16:15 ` Dmitry A. Kazakov
2002-12-04 18:11 ` tmoran
2002-12-04 20:21 ` Simon Wright
2002-12-05 9:36 ` Dmitry A. Kazakov
2002-12-05 22:40 ` tmoran
2002-12-04 15:25 ` Stephen Leake
2002-12-04 16:55 ` Jeffrey Carter [this message]
2002-12-04 17:24 ` Stephen Leake
2002-12-04 17:43 ` Warren W. Gay VE3WWG
2002-12-05 1:31 ` Jeffrey Carter
2002-12-05 18:11 ` Warren W. Gay VE3WWG
2002-12-02 15:49 ` Robert A Duff
-- strict thread matches above, loose matches on Subject: below --
2002-12-03 11:52 Grein, Christoph
2002-12-04 9:39 ` Fraser Wilson
2002-12-04 10:03 Grein, Christoph
2002-12-05 6:16 Grein, Christoph
2002-12-05 9:44 ` Dmitry A. Kazakov
2002-12-05 6:28 Grein, Christoph
2002-12-05 14:19 ` Stephen Leake
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox