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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,fb45e48e8dddeabd X-Google-Attributes: gid103376,public From: Richard D Riehle Subject: Re: Ada Protected Object Tutorial #1 Date: 1999/12/31 Message-ID: <84j4ed$8cq$1@nntp6.atl.mindspring.net>#1/1 X-Deja-AN: 566959659 References: <839toq$pu$1@bgtnsc03.worldnet.att.net> <385AC716.7E65BD5C@averstar.com> <845pgk$qkf$1@nnrp1.deja.com> <846rk7$gba$1@nnrp1.deja.com> <848ajb$o39$1@nntp2.atl.mindspring.net> <848rus$s6v$1@nnrp1.deja.com> Organization: MindSpring Enterprises X-Server-Date: 31 Dec 1999 20:41:49 GMT Newsgroups: comp.lang.ada Date: 1999-12-31T20:41:49+00:00 List-Id: In article <848rus$s6v$1@nnrp1.deja.com>, Robert Dewar wrote: >A semaphore is a particular synchronization mechanism with >advantages and disadvantages. Lots of disadvantages. More than commonly noted. This is especially true when using languages other than Ada or when using certain embedded R/T OS. I ran across a very nice exposition of this issue last week while browsing through a new book, "An Embedded Systems Primer," my David Simon. This, by the way, is a good book for an introductory course on embedded systems programming, although there is no mention of Ada. >A protected object is a language mechanism for CREATING >synchrnonization mechanisms. Agreed. Is it always the best choice? Not sure. When should one use the semaphores provided by an embedded O/S, or the hardware semaphores available in some environments? >Indeed a very standard example of the use of protected types >is to implement a standard semaphore. Yes, this is a common example and it sometimes leads the designer away from the more robust option of a fully encapsulated set of values. If one is determined to implement a semaphore, a protected object is a better choice than a task. However, Burns and Wellings in "Concurrency in Ada" note that full encapsulation is the real value of a protected resource, and express caution about low-level mechanisms such as semaphores versus the reliability of a "monitor" mechanism a la the protected object. Richard Riehle