• Post Reply Bookmark Topic Watch Topic
  • New Topic

Threads on Multiple Processors  RSS feed

 
Chris Dancy
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I was sitting in my operating systems class today, and the professor told me that all threads created in a java app will stay on one processor even though there may be 4. I had a hard time believing this, so i've come to ask if this is in fact true? and if it is then why? cause my professor, though a nice guy, is a bit foreign and his ability to explain things leaves a bit to be desired.
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I was sitting in my operating systems class today, and the professor told me that all threads created in a java app will stay on one processor even though there may be 4.


Well, it may be true -- if your professor is still using a JVM from the 1990's.

Around Java 1.2 (BTW, we are currently at Java 6), Java started to use native threads as the threading enviroment. This means that Java started passing the duties of threads to the OS itself. Prior to that, it used a "green threads" library, which simulated threads on the single processor thread.

As for the OS threads... Currently, Windows, Linux, Solaris, etc., can all dispatch different threads to different processors -- allowing it to use all the processors available.

Henry
 
Chris Dancy
Ranch Hand
Posts: 136
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Henry. I had a good feeling he was wrong. I had also poked around the net for some answers and found everyone saying the same thing. But I wanted to hear from someone who knew what they were talking about. And by the way i just bought your java threads book over the winter break, and its very informative and well written. Thanks for the answer, and for the great book on java threads.
 
Nicholas Jordan
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This actually relevant to some recent news in the last few days.

European-led project seeks development of real-time Java technologies

My first write of my project relied on the concept of a Thread of execution being "running" something with would do some work. I wrote a fancy thread management loop right in my main() - okay, I was running on a uni-processor machine -- the scheduling acted like a stack but it was clear that even on the popular consumer grade kernel the system as a whole was doing threading.

Intel has a 80-core running on the bench today, TAMU just got a Hydra, JVM will do parallelization - probably on the fly - load times remain sluggish where the paging in is from rapidly spinning platters but with today's silicon we are likely to see apps loaded over OC splitting up across an 8x8 wafer field of nano-bytes ~ my first design anticipates this future with a 64 byte datatype that could be a gate for an 80 core leaving 16 cores for machine management.

Right now I am having to go back and study what you probably already have accomplished.

Combinatorics.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!