[719] in java-interest

home help back first fref pref prev next nref lref last post

Re: Threads and select ()

daemon@ATHENA.MIT.EDU (Jonathan Payne)
Mon Jul 17 16:10:19 1995

Date: Mon, 17 Jul 1995 11:26:05 -0700
From: jpayne@starwave.com (Jonathan Payne)
To: arista@art.redstar.com
Cc: java-interest@java.Eng.Sun.COM, arista@art.redstar.com
In-Reply-To: <199507171558.LAA02925@art.redstar.com> (message from Nathan Abramson on Mon, 17 Jul 1995 11:56:28 -0400)

> From: Nathan Abramson <arista@art.redstar.com>
> Date: Mon, 17 Jul 1995 11:56:28 -0400
> X-Sender: arista@192.233.88.1
> Sender: owner-java-interest@java.sun.com
> Precedence: bulk
> X-Info: To unsubscribe, send 'unsubscribe' to java-interest-request@java.sun.com
> Content-Type: text
> Content-Length: 986
> 
> 
> Maybe someone could help me out with a couple of questions I have
> regarding Threads...
> 
> 1) Is the thread multitasking preemptive, or cooperative?  The "synchronized"
>    keyword seems to imply preemptive threading, but then the "yield ()"
>    function seems to imply that the programmer has to explicitly give
>    control to another thread (which I found to be the case).  If the
>    latter is true, why?  Shouldn't an interpreter be able to handle
>    preemptive multithreading?

Higher priority threads preempt lower priority ones.  Threads at the
same priority do not preempt, so that's why yield() is there.

> 2) There is a function to put a thread to sleep for a certain length of
>    time.  But is there a way for a thread to sleep while waiting for
>    file descriptor activity, ala UNIX select ()?  If not, is there a
>    way to make a network server or other event-driven application based
>    on file descriptors run without the dreaded load of "1.00" when idle?

You can block on read(), which implies a separate thread for each
socket.  Which may or may not be bad depending one what you're trying
to do.

I wanted to implement select() a while ago and mentioned it to the
java team but they blew me off, so I blew it off.

> Nathan Abramson
> Art Technology Group
> 
> -
> Note to Sun employees: this is an EXTERNAL mailing list!
> Info: send 'help' to java-interest-request@java.sun.com
> 

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post