htoon :
hello
I have a dual-processor system. I would like to assign one of the processors to a specific program automatically so that i do not need to do manually. Can anyone know how to do. Please help me out.
Take care.
AutoIt has all this stuff builtin now and is quite easy to use. You just write BASIC like scripts and run them directly through AutoIt shell integrated interpreter or compile them to .exe's. It is a very mature piece of free software:
http://www.autoitscript.com/autoit3/
PM me if you need any help sorting out your own solution!!
Bob
Here is a sample script I wrote for assigning x264 worker encoding processes:
(it just sleeps in the background and with 1 x264 worker it assigns the process both cores, with 2 x264 workers it assigns one process to core 1 and the other process to core 2)
I am afraid the
_WinAPI_SetProcessAffinityMask needs a process handle and not a PID (process ID number) hence the use of the
_WinAPI_OpenProcess call (converts a PID to a handle)!!
[fixed]#cs ----------------------------------------------------------------------------
AutoIt Version: 3.2.10.0
Author: Robert Walker
Script Function:
Multicore auto-task assigner
#ce ----------------------------------------------------------------------------
#Include <WinAPI.au3>
Const $c_x264_executable="x264.exe"
Global $a_x264_PID_list, $h_x264
While 1
Sleep(10000)
$a_x264_PID_list = ProcessList ($c_x264_executable)
Switch $a_x264_PID_list[0][0]
Case 1
$h_x264 = _WinAPI_OpenProcess($PROCESS_QUERY_INFORMATION+$PROCESS_SET_INFORMATION, False, $a_x264_PID_list[1][1])
_WinAPI_SetProcessAffinityMask($h_x264, 0x03)
Case 2
$h_x264 = _WinAPI_OpenProcess($PROCESS_QUERY_INFORMATION+$PROCESS_SET_INFORMATION, False, $a_x264_PID_list[1][1])
_WinAPI_SetProcessAffinityMask($h_x264, 0x01)
$h_x264 = _WinAPI_OpenProcess($PROCESS_QUERY_INFORMATION+$PROCESS_SET_INFORMATION, False, $a_x264_PID_list[2][1])
_WinAPI_SetProcessAffinityMask($h_x264, 0x02)
EndSwitch
WEnd
Exit
[/fixed]