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!news1.google.com!eweka.nl!lightspeed.eweka.nl!62.179.104.142.MISMATCH!amsnews11.chello.com!nuzba.szn.dk!news.jacob-sparre.dk!pnx.dk!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Robert Dewar's great article about the Strengths of Ada over other langauges in multiprocessing! Date: Thu, 13 Mar 2008 20:12:40 -0500 Organization: Jacob's private Usenet server Message-ID: References: <13t4b2kkjem20f3@corp.supernews.com> <89af8399-94fb-42b3-909d-edf3c98d32e5@n75g2000hsh.googlegroups.com> <2c2989ba-a109-40d6-b0a3-f91d94a2d291@a1g2000hsb.googlegroups.com> <47d906b4$0$1804$4d3efbfe@news.sover.net> <63sn1tF29a5oiU1@mid.individual.net> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: jacob-sparre.dk 1205457168 28096 69.95.181.76 (14 Mar 2008 01:12:48 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 14 Mar 2008 01:12:48 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1914 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1914 Xref: g2news1.google.com comp.lang.ada:20357 Date: 2008-03-13T20:12:40-05:00 List-Id: "Alex R. Mosteo" wrote in message news:63sn1tF29a5oiU1@mid.individual.net... ... > Although in Ada I don't see much (or any?) use for volatile, non-atomic shared > variables outside of protected objects. > > Some flaw in my understanding? Yes, sort of. You're not considering non-tasking uses. The canonical example for Volatile is reading/writing a memory-mapped hardware device. In that case, optimizing out the reads/writes can be fatal. It doesn't directly have anything to do with tasking. (I suppose one could consider the hardware device as a sort of task, but it would be done with unusual properties.) Another purpose is for debugging. You can monitor the memory location of a Volatile object to see what is going on, without the pragma the compiler can optimize the entire object away leaving nothing to monitor. (Of course, the pragma also changes the code, which might change the bug you are trying to find.) Also, you can use Volatile on any object, whereas Atomic only works on ones the compiler can do indivisibly (usually no larger than the word size of the machine). OTOH, for communication between tasks, you have to use Atomic. (Thus large objects need a protected object or other scheme for synchronizing access.) Randy.