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, MSGID_RANDY 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: Robert Dewar Subject: Re: Ada Protected Object Tutorial #1 Date: 1999/12/26 Message-ID: <845pgk$qkf$1@nnrp1.deja.com>#1/1 X-Deja-AN: 565066975 References: <839toq$pu$1@bgtnsc03.worldnet.att.net> <385AC716.7E65BD5C@averstar.com> X-Http-Proxy: 1.0 x32.deja.com:80 (Squid/1.1.22) for client 205.232.38.14 Organization: Deja.com - Before you buy. X-Article-Creation-Date: Sun Dec 26 19:20:04 1999 GMT X-MyDeja-Info: XMYDJUIDrobert_dewar Newsgroups: comp.programming.threads,comp.lang.ada X-Http-User-Agent: Mozilla/4.04 [en] (OS/2; I) Date: 1999-12-26T00:00:00+00:00 List-Id: In article , > This very interesting article tries to explain why it > is almost always better to use protected types, and create > less tasks. It gives detailed examples of many tasking idiom, > so it is also helpful as a guide to Ada tasking. I disagree with this conclusion. Indeed my view is that it is almost always better to use an intermediate task than a protected object unless you specifically need the low level efficiency that protected objects can provide in some implementations. Why? Because protected objects in Ada have relatively nasty low level semantics that do not compose properly, because of the restrictions on potentially blocking operations (these restrictions are totally unnecessary from a semantic point of view, they are there just to allow a more efficient implementation on certain limited kinds of architectures). This means that if you use protected objects you have to operate at a lower level of abstraction. Yes, it is always reasonable to lower the level of abstraction in the interests of gaining efficiency, but you only do this if you need to. The fact that when you write a protected body, you have to be aware of the *implementation* of any subprogram that you call, to be sure that it has no blocking operations, is a serious disadvantage of using PT's. Sent via Deja.com http://www.deja.com/ Before you buy.