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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,edda2b296e2577cf X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!30g2000yql.googlegroups.com!not-for-mail From: Maciej Sobczak Newsgroups: comp.lang.ada Subject: Re: GNAT's Protected Objects Date: Tue, 9 Nov 2010 02:36:35 -0800 (PST) Organization: http://groups.google.com Message-ID: <3747e4ff-811c-4d7c-8541-a5f9573decfc@30g2000yql.googlegroups.com> References: NNTP-Posting-Host: 137.138.182.236 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 X-Trace: posting.google.com 1289298995 29389 127.0.0.1 (9 Nov 2010 10:36:35 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Tue, 9 Nov 2010 10:36:35 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: 30g2000yql.googlegroups.com; posting-host=137.138.182.236; posting-account=bMuEOQoAAACUUr_ghL3RBIi5neBZ5w_S User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.10) Gecko/20100914 Firefox/3.6.10,gzip(gfe) Xref: g2news1.google.com comp.lang.ada:15398 Date: 2010-11-09T02:36:35-08:00 List-Id: On 8 Lis, 21:34, Jeffrey Carter wrote: > If I use a Linda-like approach, with a protected procedure doling out (Row, > Column) pairs on demand, a single task is always fastest, and using multiple > tasks slows things down. This wasn't what I expected, and wondered if this is > inherent in such an approach, or specific to GNAT's way of implementing > protected objects. The protected object is shared between tasks and this sharing forces the cache to flush and synchronize between cores (or CPUs). Note that cache operates on entire blocks, which adds to the cost of data transfer. If you measure the CPU utilization, you will probably see that it is mostly idle during this test. Adding more CPUs will only make things worse. In other words, you have hoped for increased performance thanks to additional computing resources, but you lost more on communication between them. The first version scales better, because it shares less (less often). -- Maciej Sobczak * http://www.inspirel.com