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=-0.3 required=5.0 tests=BAYES_00, SUBJECT_NEEDS_ENCODING,SUBJ_ILLEGAL_CHARS autolearn=no autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: GNAT and Tasklets Date: Fri, 19 Dec 2014 17:39:39 -0600 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <455d0987-734a-4505-bb39-37bfd1a2cc6b@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1419032379 2731 24.196.82.226 (19 Dec 2014 23:39:39 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Fri, 19 Dec 2014 23:39:39 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 Xref: news.eternal-september.org comp.lang.ada:24164 Date: 2014-12-19T17:39:39-06:00 List-Id: "Natasha Kerensikova" wrote in message news:slrnm97p2q.nrc.lithiumcat@nat.rebma.instinctive.eu... > Hello, > > On 2014-12-18, Randy Brukardt wrote: >> [...] That's true of *any* Ada object -- >> without >> documentation and/or code to manage it, it should be assumed to only work >> with one task at a time. > > That's a bit at odds with a recent (or not so recent) discussion, where > I didn't find in the RM where it is written that concurrent read-only > basic operations (like access dereference, array indexing, etc) are > task-safe, and the answer was that everything should work as expected > unless explicitly noted otherwise, even when concurrency is involved. No it's not. You are talking about "operations" and I'm talking about "objects". Very different things! Now, any ADT is going to have both objects and operations, so it's rather hard to do a concurrent operation without using concurrent objects. > For example, I wrote Constant_Indefinite_Ordered_Maps (available at > https://github.com/faelys/natools/blob/trunk/src/natools-constant_indefinite_ordered_maps.ads ) > which is an ordered map based on a binary search in a sorted array. > It is meant to be task-safe without any code to manage it, basing its > safety solely under the assumption that concurrent access dereference > and concurrent array indexing are safe. Sure, those OPERATIONS are safe. But not (necessarily) access to the object: that's only safe if the object is volatile or if the object is never written. See 9.10 and the associated A(3). I personally do not believe in the "read-only" data structure (although others disagree). My experience is that such structures are usually read-mostly -- which means they still need some sort of protection. Some have claimed that protection by convention is enough -- which to me brings to mind what they say about the "rhythm" method of contraception ("people that use rhythm are called parents"). Someone will break the convention and then you'll get cars that will accelerate without commands and other lovely things. > I hope it's not a brittle assumption... It's safe if you can truly prove that the data structure is read-only and *never* gets written. I think *that* is brittle, but YMMV. Example: the parameters in my spam filter rarely change. But rarely is not never, and unless I was willing to restart the filter for every parameter change, they still have to be protected. Randy. > > Natasha