Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Utilizing second processor

 
Sudhanshu Umalkar
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way to improve performance of the java module by utilizing the second processor on a dual processor machine?
To be precise, can I execute two threads and specify exclusively to each one of them which processor (CPU) they should utilize?
How a dual processor machine can be used efficiently to improve the performance of a java application?
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24212
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
There's no way to specify the "CPU affinity" of a thread; but if you create multiple threads on a multiprocessor machine, then a well-implemented JVM will schedule them efficiently on the available processors. I've had dual-CPU Xeons for years now, and find that under both Linux and Windows, multi-threaded CPU-bound programs see an appropriate speedup on multiprocessor machines.
 
Mr. C Lamont Gilbert
Ranch Hand
Posts: 1170
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Improve java's performance to the detriment of which other program? This kind of thing is handled automatically by the operating system. If two CPUs are available and you have a program that can run concurrently, then the OS will likely make use of both CPUs. But you will not have exclusive or dedicated access.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic