Tom's Hardware > Forum > CPU & Components > CPUs > how to set processor affinity automatically

how to set processor affinity automatically

Forum CPU & Components : CPUs - how to set processor affinity automatically

Tom's Hardware: Over 1.4 million members in 6 different countries available to answer all your high-tech questions. Sign up now! Its free!
Word :    Username :           
 

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.

Sponsored Links
Register or log in to remove.

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.

Reply to ak47is1337
- 0 +

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.

Reply to htoon
- 0 +

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

Reply to Stimpy
- 0 +

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.

Reply to htoon

THG also has a utility here that you can download.

Reply to Covered_in_bees
- 0 +

Thank you for the reply which is very useful. Thank you all.

Reply to htoon

Which program did you end up using?

Reply to Action_Man

I've used this utility since they put it up, excellent!

Reply to michaelahess
- 0 +

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.

Reply to Jalida
- 0 +

htoon wrote :

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


Reply to bobwya

Jalida wrote :

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.

Reply to Anonymous
- 0 +

Anonymous wrote :

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

Reply to bobwya
Tom's Hardware > Forum > CPU & Components > CPUs > how to set processor affinity automatically
Go to:

There are 744 identified and unidentified users. To see the list of identified users, Click here.

Please mind

You are about to answer a thread that has been inactive for more than 6 months.
If you still wish to proceed, please ensure that your posting is original and does not duplicate or overlap any prior responses to this thread.

Add a reply Cancel
Sponsored links
  • Ask the community now
  • Publish
Ad
They won a badge
Join us in greeting them