Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

threads in java

 
william kane
Ranch Hand
Posts: 260
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java i was told has green threads and native threads what does this mean?
 
Sandeep Jain
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Hai,
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
 
Jim Stoll
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
William,
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.
Jim
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic