Tuesday, 15 June 2010

.net - Executing external process on concrete processor and wait for termination -



.net - Executing external process on concrete processor and wait for termination -

i looking execute external programme within .net application.

i need assign concrete processor program. need execute programme several times , every time on different processor. need wait external programme termination.

to simplify have done little spike (console) app work on it:

using system; using system.collections.generic; using system.diagnostics; using system.linq; using system.text; using system.threading.tasks; namespace executeexternalinparallelwithaffinity { class programme { static void main(string[] args) { (int = 1; < 3; i++) { var processnumber = i; task.factory.startnew(() => { process p = process.start("notepad.exe"); p.processoraffinity = (intptr)processnumber; }).continuewith(t => { console.out.writeline(string.format("process ended on processor: {0}", processnumber)); }); } console.readkey(); } } }

my questions: 1.- can assign processor affinity before executing process. 2.- in spite checkin notepad on task manager, of them assigned processor 0.

the process class not back upwards setting settings before new process starts. native createprocess api allow that, though. you'll have utilize one.

start process in suspended state. set settings like. then, resume it. way code in process run under new settings.

.net

No comments:

Post a Comment