comp.lang.ada
 help / color / mirror / Atom feed
From: Matthew Heaney <matthewjheaney@earthlink.net>
Subject: Re: Multitasking and containers
Date: Tue, 28 Nov 2006 02:19:55 GMT
Date: 2006-11-28T02:19:55+00:00	[thread overview]
Message-ID: <uvel0qpmi.fsf@earthlink.net> (raw)
In-Reply-To: pan.2006.11.28.01.45.08.406000@linuxchip.demon.co.uk.uk.uk

"Dr. Adrian Wrigley" <amtw@linuxchip.demon.co.uk.uk.uk> writes:

> Actually, I think Dmitry's view is largely valid in practice, if
> somewhat extreme.

But we were talking specifically about using a protected object to implement a
multiple readers schema vs. using a protected object to implement a Hoare-style
monitor.  Because reads must by synchronized, the standard container library
requires a monitor-style synchronization scheme.

The OP made the argument that this isn't very efficient, and Dmitry responded
by saying, "well of course systems require custom hand-made solutions." But the
premise is all wrong, so what Dmitry said is irrelevant.  The OP (not Dmitry)
seems to be confused (he was asking the question, after all) about the
difference between a mutex and a monitor.  He (the OP) probably doesn't
understand that monitor-type synchronization executes on the current thread, so
there's no context switch, and so there's no efficiency loss.

The only time when monitor-style synchronization would be inappropriate is if
the protected operation needed to make a "potentially-blocking call," but
that's not the case here so there's no reason (certainly there's no efficiency
reason) not to use a monitor.



  reply	other threads:[~2006-11-28  2:19 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-24  8:51 Multitasking and containers Maciej Sobczak
2006-11-24 10:11 ` Georg Bauhaus
2006-11-24 10:19 ` Dmitry A. Kazakov
2006-11-24 10:35   ` Maciej Sobczak
2006-11-24 11:14     ` Dmitry A. Kazakov
2006-11-24 12:13       ` Matthew Heaney
2006-11-27  4:17         ` Jeffrey R. Carter
2006-11-27 10:30           ` Georg Bauhaus
2006-11-27 18:41             ` Jeffrey R. Carter
2006-11-27 18:57               ` Dmitry A. Kazakov
2006-11-27 19:45               ` Matthew Heaney
2006-11-27 21:15                 ` Simon Wright
2006-11-28  1:43                 ` Dr. Adrian Wrigley
2006-11-28  2:19                   ` Matthew Heaney [this message]
2006-11-28  8:50                     ` Dmitry A. Kazakov
2006-11-28 10:31                       ` Georg Bauhaus
2006-11-28 11:24                         ` Dmitry A. Kazakov
2006-11-29  8:51                           ` Georg Bauhaus
2006-11-28 17:12                       ` Matthew Heaney
2006-11-28 18:21                         ` Dmitry A. Kazakov
2006-11-28 19:17                           ` Matthew Heaney
2006-11-29 18:43                             ` Dmitry A. Kazakov
2006-11-29 10:14                       ` Maciej Sobczak
2006-11-29 15:50                         ` Matthew Heaney
2006-11-24 12:12     ` Matthew Heaney
2006-11-24 12:05   ` Matthew Heaney
2006-11-24 12:02 ` Matthew Heaney
replies disabled

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