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.8 required=5.0 tests=BAYES_00,INVALID_DATE autolearn=no autolearn_force=no version=3.4.4 Path: utzoo!attcan!uunet!ncrlnk!ncrcae!hubcap!gatech!ukma!mailrus!tut.cis.ohio-state.edu!ucbvax!VLSI.JPL.NASA.GOV!larry From: larry@VLSI.JPL.NASA.GOV Newsgroups: comp.lang.ada Subject: Shared Data Message-ID: <890310130557.223b@VLSI.JPL.NASA.GOV> Date: 10 Mar 89 21:05:57 GMT Sender: daemon@ucbvax.BERKELEY.EDU Organization: The Internet List-Id: > From: gcs81765@zach.fit.edu ( TSIGLER) > I would like to learn about tasks sharing global data (critical sections). I found it interesting where I found a discussion of this & how much time was spent on it. I first looked in Designing_Large_Real-Time_Systems_with_Ada by Nielsen & Shumate. They say that it's very dangerous & don't do it. If you do, use a task to monitor & limit its use. They give two, short slightly differing examples. Total pages used: less than three, two pages being very similar, the other page repetitions of "Don't do it" in various places. Next I looked in Ada:_Concurrent_Programming by Gehani. This also discouraged sharing & gave a couple of exclusion rules to use if you do. He also suggests using the SHARED pragma for scalars so that the compiler will automatically protect the shared scalar. (The Neilsen & Shumate just came out, but the Gehani is dated 1984; there may be a newer edition that discusses this more.) System_Design_with_Ada by Buhr gives an example that uses shared data and in the post-mortem points out the dangers of using it in half a page. Programming_with_Ada by Barnes says don't do it unless you consult your local real-time specialist. Software_Engineering_with_Ada by Booch doesn't mention it; his Software_Components_with_Ada spends about one page, including an example where shared access is guarded. Several texts that are intended to be simple introductions to Ada barely even mention tasking, much less shared data. The most complete discussion I found was in Ada_as_a_Second_Language by Cohen. It used eight pages. After appropriate warnings, he gives several alternatives & examples, including using the SHARED pragma (which is limited to non-composite data). He also discusses some of the tradeoffs involved. More complete (and thus difficult) discussions of shared data & tasks will probably be found in books, newsletters, & other journals that don't specialize in Ada. If you have access to a top-notch biblio searching facility try that but I'm not too optimistic. If you haven't such access, look first at the table of contents of the last two years of IEEE Trans. on SW Egr and ACM Trans. on Prog. Lang. & Systems. Larry @ VLSI.JPL.NASA.GOV