wood burning stoves
The moose likes Java in General and the fly likes threads in java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "threads in java" Watch "threads in java" New topic

threads in java

william kane
Ranch Hand

Joined: Nov 21, 2000
Posts: 260
java i was told has green threads and native threads what does this mean?

Help me!Help you!!!
Sandeep Jain
Ranch Hand

Joined: Oct 25, 2000
Posts: 124

Even I dont know much about it ,So excuse me if this information is wrong.
What I know about the green threads are like they are used by the jvm and not mapped on to multiple operating system and it does not support native methods.

Sandeep Jain

Try and Try Till u succeed<br /> <br />Sandeep Jain
Jim Stoll

Joined: May 22, 2000
Posts: 13
I'm not Thread expert, but I've done a bit of Thread programming. My understanding of the main 'how does it affect me' aspect of the difference is that 'green' threads don't support time-slicing - the thread runs until its done or until it encounters yield() or sleep(), so if you have a loop, for instance, you're well advised to put yield or sleep in your loop if you want other threads to have a chance to do things. Otherwise the thread executing the loop in a green threads envoronment acts selfishly and hogs the processor. I'm only aware of this being a problem in the 1.x implementation of the JVM on Solaris (not sure if/how other Unix or Linux systems are affected). The newer 'native' threads on Solaris are supposed to support time-slicing (or some other scheme that prevents selfish threads from hogging things). This isn't a real problem on NT, as NT uses time-slicing anyway.
I agree. Here's the link: http://aspose.com/file-tools
subject: threads in java
jQuery in Action, 3rd edition