• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Green threads and multiple processors

 
Michael Hildner
Ranch Hand
Posts: 297
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think I remember reading somewhere that green threads can not take advantage of multiple processors. This is on a Sun box. Is this true?
 
Jim Baiter
Ranch Hand
Posts: 532
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Native threads generally map to either a native OS/System thread or LightWeight Process. This means that when you create a new thread in Java, you get a new OS thread. In the case of Green threads, java creates and manages it's own virtual threads which don't have a corresponding OS thread. In this case Java and the application(s) it's running all effectively run in a single OS thread. So you're right, they won't take advantage of parallelism.
 
tom Su
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
care to explain. what is a Green thread?
 
Cindy Glass
"The Hood"
Sheriff
Posts: 8521
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


Green threads appear to be an artifact of the original Green Project, which was trying to design a hand-held computer based on the Sparc chip. So the original Java (the called "Oak") VM was written to run directly on the Sparc, without Solaris/SunOS. Because of that, they had to roll their own
thread support. The project to transform Oak into Java had very limited resources initially, they only did the bare minimum to port the language to desktop computers (as anyone who ever used the 1.0 AWT can attest). So they kept Green threads in the Solaris version because it worked, kind of.
The Green threads implementation used all kinds of tricks to make sure that I/O never blocked the single native thread. When these tricks failed, the VM would hang until the I/O request completed.
BTW, it turns out that a one-to-one mapping of VM to native threads isn't optimal either, because native threads tend to have quite a bit of overhead. The current production release of the Solaris VM uses multiple native threads, with each native thread servicing a number of VM threads.
John Brewer
Jera Design

From:
http://www.mail-archive.com/advanced-java@xcf.berkeley.edu/msg04550.html
This is a Solaris discussion:
http://godzilla.cs.nwu.edu/info/java/tooldocs/solaris/threads.html
 
Sanjay Deshpande
Ranch Hand
Posts: 111
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
HI ,
COULD ANY ONE PLEASE LEMME KNOW ANY LINK THAT 'LL GIVE COMPLETE INFO ON GREEN THREAD ??
ANY WHERE ON NET ...
PLEASE LEMME KNOW....
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic