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!news1.google.com!news.germany.com!feed20.multikabel.net!multikabel.net!feed10.multikabel.net!hwmnpeer01.ams!news-out.ntli.net!newsrout1-gui.ntli.net!ntli.net!news.highwinds-media.com!newspeer1-win.ntli.net!newsfe5-win.ntli.net.POSTED!53ab2750!not-for-mail From: "Dr. Adrian Wrigley" Subject: Re: Does Ada tasking profit from multi-core cpus? User-Agent: Pan/0.14.2 (This is not a psychotic episode. It's a cleansing moment of clarity.) Message-Id: Newsgroups: comp.lang.ada References: MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit Date: Tue, 06 Mar 2007 16:53:44 GMT NNTP-Posting-Host: 82.21.99.109 X-Trace: newsfe5-win.ntli.net 1173200024 82.21.99.109 (Tue, 06 Mar 2007 16:53:44 GMT) NNTP-Posting-Date: Tue, 06 Mar 2007 16:53:44 GMT Organization: NTL Xref: g2news2.google.com comp.lang.ada:9726 Date: 2007-03-06T16:53:44+00:00 List-Id: On Mon, 05 Mar 2007 23:33:31 -0600, tmoran wrote: >> 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 What is the next line meant to do? > change_count := change_count; > global_flag := id; > end if; > end loop; > return change_count; > end f; > end pt; Change_count is set to zero, and never changes. Function always returns zero. Surprised? Is there meant to be an increment in the code? did I miss something? -- Adrian