wood burning stoves 2.0*
The moose likes Java in General and the fly likes JVM - Reducing number of CPUs.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "JVM - Reducing number of CPUs.." Watch "JVM - Reducing number of CPUs.." New topic

JVM - Reducing number of CPUs..

Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
I was wondering if there is a way to reduce the number of CPUs on my Windows machine programmatically in Java or atleast as a command line parameter to the JVM. I would like my tests to run with just 1 CPU on the Windows(XP Prof) machine, just to check performance.

I googled on the net and found that it can be done by making a change to the registry, but I am not comfortable doing that.

- Vishwa
Peter Chase
Ranch Hand

Joined: Oct 30, 2001
Posts: 1970
In Windows Task Manager, you can do Set Affinity on a process, to adjust which CPU(s) it runs on.

Does that help?

Betty Rubble? Well, I would go with Betty... but I'd be thinking of Wilma.
Vishwa Kumba
Ranch Hand

Joined: Aug 27, 2003
Posts: 1064
thanks Pete,
that worked! I was using eclipse, so I set the Affinity(Number of CPUs) to the eclipse process and it launched my JVM with just one 1 cpu.
I checked up with the foll. call:

subject: JVM - Reducing number of CPUs..
Similar Threads
Threads running on single-core or multi-core?
Multiple CPU
64 bit and 32 bit ?
Websphere and dual cpus
multithreading in single cpu