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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,52fd60a337c05842 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-06-16 21:52:28 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!news.maxwell.syr.edu!news-out.nuthinbutnews.com!propagator-sterling!news-in.nuthinbutnews.com!cyclone1.gnilink.net!wn3feed!worldnet.att.net!bgtnsc04-news.ops.worldnet.att.net.POSTED!not-for-mail Message-ID: <3D0D6AEE.80304@worldnet.att.net> From: Jim Rogers User-Agent: Mozilla/5.0 (Windows; U; Win98; en-US; rv:0.9.4) Gecko/20011128 Netscape6/6.2.1 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: ada paper critic References: <8avjgu8bnkifee01ffu5i4h247n3khl7ub@4ax.com> <3D0A075F.482703FE@san.rr.com> <3D0CA980.5050505@worldnet.att.net> <3D0D605B.F86B0670@san.rr.com> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Date: Mon, 17 Jun 2002 04:52:28 GMT NNTP-Posting-Host: 12.86.37.216 X-Complaints-To: abuse@worldnet.att.net X-Trace: bgtnsc04-news.ops.worldnet.att.net 1024289548 12.86.37.216 (Mon, 17 Jun 2002 04:52:28 GMT) NNTP-Posting-Date: Mon, 17 Jun 2002 04:52:28 GMT Organization: AT&T Worldnet Xref: archiver1.google.com comp.lang.ada:26116 Date: 2002-06-17T04:52:28+00:00 List-Id: Darren New wrote: > Jim Rogers wrote: > >>The first problem is that Java does not have protected objects in the >>Ada sense of the term. Java only provides synchronization blocks, which >>are not even close to being protected objects. >> > > If every routine of a class is declared synchronized, I think you get > something close to protected objects as long as you're not doing real-time, > not worried about priority inversion, and etc. All of which Ada gets right, > of course. Which you amply demonstrate in your post. I disagree. You get a lot of object locking, but a protected object is much more than simple object locking. You do not get the ability to do shared reads of the object as you get from Ada protected functions. You get no equivalent to entry queues. You have no equivalent to the Ada select command. You simply have built-in syntax for manipulating an object-wide mutex. Note that it is also extremely difficult in Java to simulate an Ada rendezvous. > > >>Java's threading model works very well as long as your threads do not >>communicate with each other, >> > > Basically, you have to build your own entry queues in Java's threads, just > like you had to build your own protected objects in Ada 83. I tried to describe why you cannot simply build your own entry queues in Java. The problem is the Java definition of the wait() and notify() methods. They control thread suspension and activation due to changes in shared object conditions. They provide completely non-deterministic results when activating a suspended thread. You have no access to the way they work, nor can you redefine their operation without encountering rather nasty behaviors in the Java memory model, which is generally NOT implemented as defined for the Java Virtual Machine. > > >>and they never need to be terminated. >> > > I'm pretty sure you can force a Java thread to throw an error, thereby > terminating. Yes, you can force a thread to throw an exception, but that means that all your threads must declare that they throw whichever exception you want to used. This is clearly an uncommon design choice in Java. > > Anyway, I was commenting not on the fact that Java is better or worse than > Ada in terms of tasking. Clearly Ada wins hands down over any other GP > language. All I was addressing was > > >>>>like non-OO task >>>>and protected object types, can be excused by the fact that other >>>>languages have no such types at all. >>>> > > and wondering why the poster felt that Java didn't have tasks or protected > types. I didn't literally mean "what's wrong with Java's threads", but > rather "why do you feel they're so broken that you don't even call them > threads?" Java does have threads. It clearly does not have protected types. Instead it has an overly simple and primitive view of object locking using a classic mutex. Jim Rogers