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,e81fd3a32a1cacd2 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news2.google.com!news.germany.com!newsfeed-0.progon.net!progon.net!news-zh.switch.ch!kanaga.switch.ch!switch.ch!newsserver.news.garr.it!newsserver.cilea.it!not-for-mail From: Colin Paul Gloster Newsgroups: comp.lang.ada Subject: Re: Does Ada tasking profit from multi-core cpus? Date: 6 Mar 2007 09:40:58 GMT Organization: CILEA Message-ID: References: NNTP-Posting-Host: docenti.ing.unipi.it X-Trace: newsserver.cilea.it 1173174058 2761 131.114.28.20 (6 Mar 2007 09:40:58 GMT) X-Complaints-To: news@cilea.it NNTP-Posting-Date: 6 Mar 2007 09:40:58 GMT Xref: g2news2.google.com comp.lang.ada:9716 Date: 2007-03-06T09:40:58+00:00 List-Id: Tom Moran posted on Mon, 05 Mar 2007 23:33:31 -0600: "> 1. Whether protected object's functions are indeed executed concurrently > when come from the tasks running on different cores? A quick test with a single protected object containing a single, long-duration, function appears to have just one call of the function active at a time, even if the function is called from two different tasks. global_flag : integer := 0; protected body pt is function f(id : integer) return natural is change_count : natural := 0; begin global_flag := id; for i in 1 .. 10_000_000 loop if global_flag /= id then change_count := change_count; global_flag := id; end if; end loop; return change_count; end f; end pt; One task calls pt.f(id=>1) and the other calls pt.f(id=>2). They both get a result of zero back from their function call. This was with Gnat 3.15p Windows 2000 on a dual core Pentium. If I change it from a single protected object to two instances of a protected type, then the function calls are overlapped and return non-zero results. [..]" I am grateful to Thomas Moran for such a brilliant demonstration of how poor the so-called GNU Ada Translator can be.