R
Ramon F Herrera
This is under Windows XP.
I wrote a couple of programs: the first one in C++ does
some number crunching and the other one in Java which
provides an outside loop to execute the *.exe repeatedly.
The source code looks something like this:
for (i = 0; i < 500; i++) {
commandLine = "C:/path/to/number/crunch.exe";
Runtime.getRuntime().exec(commandLine);
}
The problem is that the above approach brings WinXP to
its knees. Coming from Unix, I figured that the OS would
take care of "rationing" the processes and only starting them
when resources were sufficient, instead of choking the CPU
and page file.
In Unix, I would add a 'wait();' after the fork-exec().
Should I use threads for this? How?
-Ramon F Herrera
I wrote a couple of programs: the first one in C++ does
some number crunching and the other one in Java which
provides an outside loop to execute the *.exe repeatedly.
The source code looks something like this:
for (i = 0; i < 500; i++) {
commandLine = "C:/path/to/number/crunch.exe";
Runtime.getRuntime().exec(commandLine);
}
The problem is that the above approach brings WinXP to
its knees. Coming from Unix, I figured that the OS would
take care of "rationing" the processes and only starting them
when resources were sufficient, instead of choking the CPU
and page file.
In Unix, I would add a 'wait();' after the fork-exec().
processes at at time, before exec'ing the next one?From a more general perspective: how can I allow, say 5
Should I use threads for this? How?
-Ramon F Herrera