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!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!130.59.10.21.MISMATCH!kanaga.switch.ch!news-zh.switch.ch!switch.ch!cernne03.cern.ch!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: Multitasking and containers Date: Wed, 29 Nov 2006 11:14:35 +0100 Organization: CERN News Message-ID: References: <143yx0dos45nx.159wpxvfevtt8.dlg@40tude.net> <1164623427.5986.11.camel@localhost> <1164656708.657952.123430@j72g2000cwa.googlegroups.com> NNTP-Posting-Host: abpc10883.cern.ch Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Trace: cernne03.cern.ch 1164795275 27325 137.138.37.241 (29 Nov 2006 10:14:35 GMT) X-Complaints-To: news@@cern.ch NNTP-Posting-Date: Wed, 29 Nov 2006 10:14:35 +0000 (UTC) User-Agent: Thunderbird 1.5.0.8 (X11/20061113) In-Reply-To: Xref: g2news2.google.com comp.lang.ada:7734 Date: 2006-11-29T11:14:35+01:00 List-Id: Dmitry A. Kazakov wrote: >> The OP (not Dmitry) >> seems to be confused (he was asking the question, after all) about the >> difference between a mutex and a monitor. I was asking a question about strategy to use a standard container in a multitasking environment, not what's the difference between a mutex and a monitor. I don't see any implication for confusion in the latter. >> 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 efficiency loss might be possible due to contention on the shared resource. It is clear that with single CPU there is nothing to fuss over, but the concept of "single CPU" became somewhat fuzzy nowadays. > I read OP question very differently. He said (let Maciej correct me): > > 1. That accessing a mutable operation disguised as a protected object's > function were wrong. > > 2. Using a protected object's procedure/entry would kill concurrency by > serialization of the action to undertake. > > Both statements are evidently true. And that's exactly what I meant. > My comments considered possible solutions *provided* that 2 were really a > problem And that's absolutely a non-issue. I'm interested in principles and rationale - a clear understanding of the tools is crucial at the very early stages of project development, because it's when the decisions have the biggest impact on later phases. What I've learned in this thread is that: 1. Ada standard containers should be protected against concurrent accesses (in the general meaning of "access") and it's the obligation of the user to do it. 2. This serializes all users of the container with obvious consequences. Whether any of these two is a problem in any particular project is a non-issue. The point is that these two facts are to be understood, so that they can be taken into account when there's a time to do so. -- Maciej Sobczak : http://www.msobczak.com/ Programming : http://www.msobczak.com/prog/