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.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: ffc1e,fb45e48e8dddeabd X-Google-Attributes: gidffc1e,public X-Google-Thread: 103376,fb45e48e8dddeabd X-Google-Attributes: gid103376,public From: kaz@ashi.footprints.net (Kaz Kylheku) Subject: Re: Ada Protected Object Tutorial #1 Date: 1999/12/19 Message-ID: #1/1 X-Deja-AN: 562525190 Cache-Post-Path: ashi.FootPrints.net!unknown@localhost References: <839toq$pu$1@bgtnsc03.worldnet.att.net> <385AC716.7E65BD5C@averstar.com> <83hi68$75k$1@nntp4.atl.mindspring.net> X-Complaints-To: abuse@direct.ca X-Trace: brie.direct.ca 945575908 204.239.179.1 (Sat, 18 Dec 1999 19:58:28 PST) Organization: Psycho-Neurotic Institute for The Very, Very Nervous X-Cache: nntpcache 2.3.3b3 (see http://www.nntpcache.org/) User-Agent: slrn/0.9.5.7 (UNIX) Reply-To: kaz@ashi.footprints.net NNTP-Posting-Date: Sat, 18 Dec 1999 19:58:28 PST Newsgroups: comp.programming.threads,comp.lang.ada Date: 1999-12-19T00:00:00+00:00 List-Id: On 19 Dec 1999 03:07:52 GMT, swhalen@netcom.com wrote: >In comp.lang.ada Kaz Kylheku wrote: >... >: It is a cost. I'm not convinced that it's not a cost that is also present >: in Ada implementations, albeit hidden from the programmer. Unless the Ada >: implementation has complete control over thread scheduling, > which is obviously >: not true of Ada implementations that run on top of many kinds of operating >: systems. >... > >This "clairvoyance" we seem to be talking about is _not_ "hidden from >the programmer". In Ada you (the programmer) pay a one time "price" >in learning the Ada95 language and you get the benefit of some very >well thought out tools like protected objects. > >Once you pay the price of learning how to use Ada95 properly, you gain >the benefit of the compiler and run-time being able to handle many >common situations without the comiler having to ever call any >underlying operating system facility at all. Thus there is a genuine >reduction in overhead compared to using POSIX or other system >facilities in the manner you discuss. POSIX is an interface which can also be implemented such that it handles common situations without calling into an operating system. A trivial example of that would be seizing a pthread_mutex_t lock when there is no contention. The POSIX threading functions are not necessarily system calls. Just because something is not built into the language syntax, and the name of its specification rhymes with UNIX doesn't mean that it's a call into the opearting system. > Ada95's tools do _not_ try to >cover all situations, but try to cover many of the problems most >commonly encountered in the real world. The protected types as described are utterly useless to me because of the limitations of what they can do. I can't think of any software I have written in the past two years in which protected types could have been applied (had I been working in Ada). In almost everything I have done, there are complex relationship among the collaborating objects. There are calls among the objects from within critical regions, as well as condition waits in arbitrary places. >In otherwords: the Ada95 programmer pays a price in the discipline of >knowing the language and using it properly. Non sequitur. I was talking about the cost of implementing specific semantics, such as atomically passing ownership of a locked object to a specific thread so that the thread doesn't have to re-evaluate a predicate. Not some human resource cost of learning. I don't appreciate people going wishy washy on me in a technical debate. The fact is, if you have a thread running on another processor that is about to seize a lock, and you have to suspend that thread because the current owner is passing ownership of the lock to some specific thread, that is a waste of processor time. I'd like to hear from somone who has experience with these so-called protected types on a machine with 16 processors or more. What is the scalability like of existing implementations?