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 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,16594902ce57591b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news4.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread2.news.pas.earthlink.net.POSTED!14bb18d8!not-for-mail Sender: Matthew Heaney@MHEANEYIBMT43 Newsgroups: comp.lang.ada Subject: Re: Multitasking and containers References: <143yx0dos45nx.159wpxvfevtt8.dlg@40tude.net> <1164623427.5986.11.camel@localhost> <1164656708.657952.123430@j72g2000cwa.googlegroups.com> From: Matthew Heaney Message-ID: User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3 MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Tue, 28 Nov 2006 02:19:55 GMT NNTP-Posting-Host: 24.149.57.125 X-Complaints-To: abuse@earthlink.net X-Trace: newsread2.news.pas.earthlink.net 1164680395 24.149.57.125 (Mon, 27 Nov 2006 18:19:55 PST) NNTP-Posting-Date: Mon, 27 Nov 2006 18:19:55 PST Organization: EarthLink Inc. -- http://www.EarthLink.net Xref: g2news2.google.com comp.lang.ada:7719 Date: 2006-11-28T02:19:55+00:00 List-Id: "Dr. Adrian Wrigley" 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.