On Mon, 31 May 1999 15:53:18 +0200, Per Widerlund wrote:

>Michael Sinz wrote:
>MS> Why?  Java is platform independant and many (most) non-UNIX
>MS> platforms use other mechansims and, if they have a POSIX
>MS> layer, they emulate it only.
>
>If that is the case, then there is nothing to do - Java must
>remain platform independent. I thought that something similar to
>select was available in all OS:es.

Not really.  Some OSes have a more general notification mechansism
that is not tied to file handles at all.  Some do not directly support
sync and async operations on the same file handle (you have to open
it specifically for the way you want to do the I/O - makes the POSIX
layer really tricky)

>MS> Second, Java has threads built in.  Why not use them?
>MS> One of the really nice parts of Java is that it has some
>MS> of these concepts, such as threads and synchronization
>MS> built in.  This is part of the language specification.
>MS> One should use those mechanisms.
>
>A thread uses lots of resources. I am not sure I buy your
>argument: threads are part of the specification and therefore
>we cannot change the specification..

Well, threads may or may not take large amounts of resources.
A JVM could have very light threading overhead.  On Linux, the
green threads are rather light but the native threads are rather
heavy.  This is a JVM and native platform issue, much like any
other performance, compatibility, and capability issue.  Some JVMs
will be better while others will be rather poor.  Some platforms
will also do better with JVMs and others will not.  (OS/2 seems to
do rather well with Java while some UNIX platforms are not too
good due to the quality of the native threading support.)

>MS> You may find out that it ends up being easier since you
>MS> write your code to deal with one file and that one file
>MS> only and just get multiple objects or different classes
>MS> together to handle the whole combination.
>
>Yes, it is indeed a simple and elegant way to handle things,
>but you waste a lot of precious resources. When you want to
>handle hundreds of socket connections and must start up two
>threads per connection you soon run into trouble.

Actually, with green threads in the JVM the thread overhead is
rather small.  Yes, it adds up but it may well be small enough
that you rather not have to deal with the complexities of other
forms.

Michael Sinz -- Director of Research & Development, NextBus Inc.
mailto:[EMAIL PROTECTED] --------- http://www.nextbus.com
My place on the web ---> http://www.users.fast.net/~michael_sinz



----------------------------------------------------------------------
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]

Reply via email to