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!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Tue, 06 Mar 2007 06:55:39 -0600 Date: Tue, 06 Mar 2007 07:47:44 -0500 From: Jeffrey Creem User-Agent: Thunderbird 1.5.0.10 (Windows/20070221) MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Does Ada tasking profit from multi-core cpus? References: In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Message-ID: NNTP-Posting-Host: 24.147.74.171 X-Trace: sv3-corK6QDUgRbJJ4eFcoLhwAZPdkAVGmokXEEQ3gQQJicZqzjWIrfT4Dl0KmvFk7t0VnNIgjdYtZ2zLcj!ELajkSDQiL8HA9EppC8L8WYykEos20LQaM8eHtwsK3MDT9fQNN8jVhXQVqP8qSeR8r6tI0iPwo5d!Z+M= X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.34 Xref: g2news2.google.com comp.lang.ada:9719 Date: 2007-03-06T07:47:44-05:00 List-Id: Colin Paul Gloster wrote: > 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. I don't think this proves that the two tasks are not overlapping. It probably proves that if you specifically write broken code it is indeed sometimes broken.