I have the same problem for Windows - running subprocesses that use all processors (thread-parallel jobs), but I want to have good responsiveness in the Windows development environment.
Solution : after starting several tasks:
DOS cmd β wmic process where name="javaw.exe" CALL setpriority "below normal"
No, this will not affect the eclipse.exe process.
Java Solution . Paste this code into your intensive programs to lower your own Windows priority.
public static void lowerMyProcessPriority() throws IOException { String pid = ManagementFactory.getRuntimeMXBean().getName(); int p = pid.indexOf("@"); if (p > 0) pid = pid.substring(0,p); String cmd = "wmic process where processid=<pid> CALL setpriority".replace("<pid>", pid); List<String> ls = new ArrayList<>(Arrays.asList(cmd.split(" "))); ls.add("\"below normal\""); ProcessBuilder pb = new ProcessBuilder(ls); pb.start(); }
Yes, verified. Powered by Win7.
George forman
source share