Advertisement

[java] Java & Dual processors

Started by December 18, 2000 07:49 AM
4 comments, last by moregames 24 years ago
Does Java make use of dual processors or does this depend on the OS? In a multi-threaded program will Java make use of two processors by distributing work/threads on both processors?
The use of dual processors depends on the OS and the JVM.

Win9x and Mac OS does not support multiple processors.

Win2000, NT, Linux, BeOS and OS X supports multiple processors.

You want a JVM that uses native threads instead of green threads. Native thread scheduling is handled by the OS, green thread scheduling is handled by the JVM.

Depending on the JVM implementation, a green-threaded JVM on a multiple processor OS will not use the second processor (I don''t have an example).
Advertisement
Sorry for being such a novice.... I''m using win2k and java 1.2 will this work? And whats the difference between green and native threads, I just initialize threads the way it''s described in books.
Well, Sun''s JVM for windows uses native threads, in all versions. That means that if you use WinNT or Win2000 with multiple processors, the JVM threads will get balanced across the processors.

I believe Sun''s JVM for Solaris also uses native threads.

As for the anonymous poster''s comments: How you initialize threads doesn''t matter, as far as whether you use green threads or native threads. That''s entirely a function of the JVM that you use.
What about Suns JVM for linux?
Well, I haven''t used Sun''s JVM for linux... However, it''s very likely that the

java -version

command will mention somewhere whether it uses native threads or green threads. If not, the information is probably available on Sun''s site somewhere, but I''m not sure where.

This topic is closed to new replies.

Advertisement