You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Threads<br />
Receive our newsletter with new tips! Almost 6,000 subscribers (by June 2001) can not be wrong!<br />
They read our tips every week! To subscribe to The <strong>Java</strong> FAQ Daily send empty e-mail to:<br />
javafaq-tips-subscribe@topica.com or visit at:<br />
http://www.topica.com/lists/javafaq-tips/<br />
Threads<br />
Can anyone please explain the difference between the two types: green threads<br />
and native threads?<br />
Answer: Green threads is thread mechanism implemented in JVM itself.<br />
It is blind and can run on any OS, so actually all threads are run in one<br />
native thread and scheduling is up to JVM. This is disadvantageously for<br />
SMP systems, since only one processor can serve <strong>Java</strong> application.<br />
Native threads is a mechanism based on OS threading mechanism. This allows<br />
to use features of hardware and OS. For example,there is IBM's JDK for<br />
AIX that supports native threads. The perfomance of applications<br />
can be highly imploved by this.<br />
Q: If a thread object has quit from run loop, how can I restart the thread object? (<br />
I don't want to use some flags with wait/notify method to simulate restarting).<br />
I try to use start() method, but it doesn't work.<br />
Answer: No - Threads can't be restarted. You have to either loop with a wait/notify or<br />
create a new Thread.<br />
--<br />
J. Skeet<br />
this advice first was published on comp.lang.java.programmer<br />
Visit us here and you will find<br />
much more tips!<br />
I'm having trouble getting sleep to work properly. It seems to just return<br />
immediately, and not sleep for the requested time. Is there some trick I need to know<br />
about? The docs say that sleep takes an argument in milli-seconds, but sleep(10000)<br />
seems to return immediately.<br />
Answer: It can happen if another thread interrupts your sleeping thread.<br />
file:///F|/350_t/350_tips/threads.htm (1 of 4) [2002-02-27 21:19:25]