Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Multi-processor support for JVM  RSS feed

 
Micah Wedemeyer
Ranch Hand
Posts: 68
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do multi-threaded Java programs running on a multi-processor machine make use of the extra processor power? Since the JVM is itself a process that is delegated to a processor, I would think that Java is destined to never truly function as a parallel language, but the Java developers have surprised me in the past.
If anyone has a definite answer, please let me know, or at least point me somewhere that I might be able to get an answer.
BTW, this is simply an academic question. I don't have anything riding on it, just curious.
Micah
 
Roy Ben Ami
Ranch Hand
Posts: 732
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i think i read somewhere in sun site (http://java.sun.com) that threads do take into consideration the extra processor and they will act diffrently on multi processor computers.
how they will act differently i dont know, but i guess they will use its power as well.
 
Peter den Haan
author
Ranch Hand
Posts: 3252
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Micah Wedemeyer:
Do multi-threaded Java programs running on a multi-processor machine make use of the extra processor power? [...]
The answer is really "it depends on the virtual machine (JVM) implementation you use". In most cases it is "yes". The most noteworthy exceptions are (older) Solaris implementations with so-called "green" threads (as opposed to "native threads").
Java was most certainly designed with parallel processing in mind, and the language (JLS) and VM specifications go to some length to define behaviour in a truly parallel environment. (Unfortunately, parallel processing being what it is, they still leave some loose ends and loopholes).
- Peter
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!