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!postnews.google.com!h54g2000cwb.googlegroups.com!not-for-mail From: "Matthew Heaney" Newsgroups: comp.lang.ada Subject: Re: Multitasking and containers Date: 28 Nov 2006 11:17:33 -0800 Organization: http://groups.google.com Message-ID: <1164741453.397227.86070@h54g2000cwb.googlegroups.com> References: <143yx0dos45nx.159wpxvfevtt8.dlg@40tude.net> <1164623427.5986.11.camel@localhost> <1164656708.657952.123430@j72g2000cwa.googlegroups.com> <1164730840.554295.78960@h54g2000cwb.googlegroups.com> NNTP-Posting-Host: 66.162.65.129 Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-Trace: posting.google.com 1164741458 30527 127.0.0.1 (28 Nov 2006 19:17:38 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 28 Nov 2006 19:17:38 +0000 (UTC) In-Reply-To: User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.8) Gecko/20061025 Firefox/1.5.0.8,gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: h54g2000cwb.googlegroups.com; posting-host=66.162.65.129; posting-account=Zl1UPAwAAADEsUSm1PMMiDjihtBlZUi_ Xref: g2news2.google.com comp.lang.ada:7730 Date: 2006-11-28T11:17:33-08:00 List-Id: Dmitry A. Kazakov wrote: > > Further, even on a single CPU, where protected functions and procedures are > equivalent, the requirement "no task switches while lock held" might be > unacceptable if you hold it for too long. But this is already a precondition for using a protected object as a monitor. The RM makes it clear that you shouldn't be doing anything that takes "too long" inside a protected operation. > Searching a container within a > protected action ... well, one should be a quite strong believer for this. If this is an associative container then no problem. If this is a sequence container with many elements, well that's another story. > I wouldn't dismiss it completely, but I definitely don't like it. For > hashes I would at least take one with an external hash function computed > outside the protected action. The issue with hash tables is not the computation of the hash value, but rather if the hash function is poor and there are many collisions. If that's the case then the time to compare the key to items already in that bucket will be large compared to the cost of computing the hash value itself.