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,971aa11c293c3db1 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-07-24 13:15:22 PST Path: archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed.nntp.primus.ca!feed.nntp.primus.ca!radon.golden.net!news1.tor.metronet.ca!nnrp1.tor.metronet.ca!not-for-mail Message-ID: <3B5DD72F.ED434E9A@home.com> From: "Warren W. Gay VE3WWG" X-Mailer: Mozilla 4.75 [en] (Windows NT 5.0; U) X-Accept-Language: en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Ada The Best Language? References: <5be89e2f.0107170838.c71ad61@posting.google.com> <5be89e2f.0107180235.726d46a8@posting.google.com> <3B55B01A.DAC06D79@icn.siemens.de> <5be89e2f.0107181248.73298c57@posting.google.com> <9j949b$1ujp$1@norfair.nerim.net> <9cV57.54954$WS4.8386096@news6-win.server.ntlworld.com> <9j98pv$20vi$1@norfair.nerim.net> <3B586C51.53C17E25@home.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Date: Tue, 24 Jul 2001 20:14:40 GMT NNTP-Posting-Host: 198.96.47.195 NNTP-Posting-Date: Tue, 24 Jul 2001 14:14:40 MDT Organization: MetroNet Communications Group Inc. Xref: archiver1.google.com comp.lang.ada:10534 Date: 2001-07-24T20:14:40+00:00 List-Id: Ted Dennison wrote: > > In article <3B586C51.53C17E25@home.com>, Warren W. Gay VE3WWG says... > > > >Hee, hee, but what are you going to do when you want to do a select(2) call > >on a dozen file descriptors? Java doesn't give you a clean way to do this, > >short of creating a dozen threads to each block on one descriptor. Or.. > >you can use non-blocking (gak) calls. Java still falls short in a number > >of places. Ada of course, would not prevent you from calling select(2) or > >poll(2). To do it in Java, requires the use of native methods, which would > >be oh so ugly (creation of a shared library etc. etc.) > > That's funny. This very much resembles a conversation I had Friday with an > anti-Ada C user. Although Ada's on the other side this time, I feel honor bound > to make the same points here that I did there. > > 1) I don't see why it is such a bad thing to make a system call from Java, and > not a bad thing to make the exact same system call from Ada. I realise that this > may reduce Java's portability, but only down to the level at which your putative > Ada example already exists. Your Ada (or Java) might be less portable for other > reasons. But then those should be addressed, not this issue. My point was primarily these two points: 1. to do native calls in Java requires you to create a shared library, install that library, establish environment if necessary (SHLIB_PATH/LD_LIBRARY_PATH) etc. Conversely, with Ada, you simply insert pragma import, then link-- no muss, no fuss. 2. The other point was that creating extra threads might be considered a heavy handed solution to the problem (depending upon application). I know someone who has had to deal with this very problem, and bemoans the lack of select/poll support. And of course, there is the whole DOS scenario, which someone else covered. > 2) Even though either language can do it just fine, I don't think "select" > support is that big of a deal anyway. Most serious network servers (according to > the literature I read) don't use select. They instead keep a pool of threads > (tasks), and assign IP connections as they come in to the next available thread. > Using "select" would tie up your entire server into processing one request at a > time, which might be OK for something that doesn't get hit a lot, but would be > horrible for a server that may expect several simultanious requests from > different parties. "select" probably has its uses, but it seems to mostly be a > holdover from the pre-thread era. Failing native calls to select/poll, Java forces you to use one thread for each socket/fd that you are waiting for events on. What may be a better approach for some server designs, is a pool of threads (yes), but not as many as you have fd/sockets for. Once an event has been registered for any of many many file descriptors (from select say), you can then pass the "job" onto one of your waiting server threads. This allows you to tune the resource requirements of your server. -- Warren W. Gay VE3WWG http://members.home.net/ve3wwg