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,e0e1d3b3f7c994b8 X-Google-Attributes: gid103376,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!postnews.google.com!b64g2000hsa.googlegroups.com!not-for-mail From: gpriv@axonx.com Newsgroups: comp.lang.ada Subject: Re: Robert Dewar's great article about the Strengths of Ada over other langauges in multiprocessing! Date: Wed, 12 Mar 2008 07:41:54 -0700 (PDT) Organization: http://groups.google.com Message-ID: References: <13t4b2kkjem20f3@corp.supernews.com> <89af8399-94fb-42b3-909d-edf3c98d32e5@n75g2000hsh.googlegroups.com> <47D39DC8.20002@obry.net> <114f711c-9cf8-4fdb-8f11-77667afb8719@c33g2000hsd.googlegroups.com> NNTP-Posting-Host: 151.196.71.114 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: posting.google.com 1205332915 24240 127.0.0.1 (12 Mar 2008 14:41:55 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Wed, 12 Mar 2008 14:41:55 +0000 (UTC) Complaints-To: groups-abuse@google.com Injection-Info: b64g2000hsa.googlegroups.com; posting-host=151.196.71.114; posting-account=YaY8rAoAAAAAnFXOECY3BGVJsrvFJCgy User-Agent: G2/1.0 X-HTTP-Via: 1.1 SPARKS X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv:1.8.1.12) Gecko/20080201 Firefox/2.0.0.12,gzip(gfe),gzip(gfe) Xref: g2news1.google.com comp.lang.ada:20314 Date: 2008-03-12T07:41:54-07:00 List-Id: On Mar 12, 9:33 am, Maciej Sobczak wrote: > On 12 Mar, 01:32, gp...@axonx.com wrote: > > > VTab is virtual call table, created when class has at least one > > virtual function. That will make it similar to tagged record. > > Otherwise it will be similar to a plain Ada record and destructor may > > be inlined. > > In C++ destructor can be inlined *always*, unless the object is > deleted via pointer to base. In other words, objects with automatic or > static storage duration (local, static and global) objects can have > inlined destructors - no matter whether it is virtual or not. Yes if compiler can make that determination at compile time. If not it will dispatch via VTab. My point was to compare make all the conditions equal. After all you may consider generic model for Ada which eliminate all the dispatch overhead. > > > With C++ to be totally multicore thread safe, you need to make > > "volatile" all the data that has any possibility to be accessed from > > different threads. > > Absolutely incorrect. > In C and C++ "volatile" has nothing to do with threads. It is neither > necessary nor sufficient. > > > Otherwise, you may get incorrect readings once in a while. > > "volatile" does not prevent it. > > > Few years > > back I spent months chasing these misreadings when moved heavily > > mullti-threded app to multi-core. > > You still have some months of chasing ahead. :-) > Start with removing all "volatile" keywords from your code. Then make > it right. > > -- > Maciej Sobczak *www.msobczak.com*www.inspirel.com Definition of volatile: The volatile keyword is a type qualifier used to declare that an object can be modified in the program by something such as the operating system, the hardware, or a concurrently executing thread. Consider the multi-core execution of two concurrent threads. One will modify a variable, another will read. One will keep the variable in the register, another will reload it from the memory. Volatile will force flushing to the memory. Otherwise thread 2 will read erroneous data.