Sign in with
Sign up | Sign in
Your question
Closed

how to set processor affinity automatically

Last response: in CPUs
Share
March 22, 2006 4:03:38 AM

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.
March 22, 2006 5:42:30 AM

To be honest, I don't think it is possible on Windows XP. If a program tried, it would probably not know what to put on what processor and not know how to handle a third window. Is it really that hard to do it manually? However, I have heard that some versions of Linux will do it automatically. PM linux_0 for more information on that.
March 22, 2006 5:56:32 AM

Thank you for the reply. it is easy to set processor affinity manually.

But I want to assign automatically so that i do not need to adjust it manually. is there anyone know how to do it. I am using winxp professional. Is it possible.

Thank you all.
Related resources
March 22, 2006 3:12:17 PM

Depending on the software there may be a registry entry you can adjust
March 22, 2006 3:33:05 PM

Depending on the software there may be a registry entry you can adjust




Thank you for your reply. Do you know how to tweak the registry.
March 22, 2006 7:52:22 PM

Thank you for the reply which is very useful. Thank you all.
March 22, 2006 8:07:48 PM

Which program did you end up using?
March 23, 2006 12:59:24 AM

I've used this utility since they put it up, excellent!
January 11, 2008 5:26:26 AM

I've tried this utility for SimCity 4, I set up the profile for the game, and set the affinity to one cpu. Task assign is running then I start the game, I alt tab to windows task manager and check the affinity of SimCity4 in task manager and it's still showing that it's assigned to 2 cpus.

Does it always do that even if taskassign is forcing it to run on one cpu? Or does task assign not actually work properly with some games. For example I can't even get Taskassign to recognize when SC4 is running, it's not one of the listed running programs even.
January 11, 2008 11:14:14 AM

htoon said:
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!! :hello: 

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)!!


#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

Anonymous
a b à CPUs
December 6, 2008 3:41:36 PM

Jalida said:
I've tried this utility for SimCity 4, I set up the profile for the game, and set the affinity to one cpu. Task assign is running then I start the game, I alt tab to windows task manager and check the affinity of SimCity4 in task manager and it's still showing that it's assigned to 2 cpus.

Does it always do that even if taskassign is forcing it to run on one cpu? Or does task assign not actually work properly with some games.

Same here, but with Stanford's Folding@Home and with the BOINC client.

Would appreciate an answer to this, because right now it looks as though that THC thing doesn't do jack.
December 6, 2008 7:59:53 PM

Quote:
Same here, but with Stanford's Folding@Home and with the BOINC client.

Would appreciate an answer to this, because right now it looks as though that THC thing doesn't do jack.


OK. I'll put a GUI front-end on my script and repost it.

Bob
!