This program allows you to manage CPU affinity for specific processes on your system, ensuring that certain processes run on specific CPU cores. It can be configured through a simple config.ini file and provides a system tray icon for reloading the said configuration.
- Windows XP or newer (compiled for Windows XP), works on Windows 2000 with BWC kernel extensions and VC++ 2019 runtime
- (Optional) Visual Studio 2019 for building the project
- Download the latest release from the Releases page.
- Extract the ZIP archive to a folder on your system.
- Configure the
config.inifile as needed (see Configuration section below). - Run
AffinityManager.exeto start the program. - (Optional) Create a shortcut to
AffinityManager.exein the Startup folder to run the program on system startup.
- Clone this repository or download the ZIP archive of the project.
- Open the solution file
AffinityManager.slnin Visual Studio 2019. - Set the build configuration to
ReleaseorDebug. - Build the project in Visual Studio (
Build -> Build Solution). - The program will output an executable file
AffinityManager.exein theDebugorReleasefolder.
The program reads from the config.ini file to determine which processes to manage and their corresponding CPU core assignments.
C:\Program Files\ExampleApp\example.exe=0,1
anotherapp.exe=2,3In this example:
example.exewill be assigned to CPU cores 0 and 1.anotherapp.exewill be assigned to CPU cores 2 and 3.
- Process Path: Full path to the executable of the process you want to manage.
- Core List: A comma-separated list of CPU cores (0-based index) to assign to the process.
All operations, including affinity assignments, errors, and warnings, are logged in the affinity.log file. This log can be used for debugging or tracking activity.
-
Run the Program:
- Double-click on
AffinityManager.exeto run the program. It will start in the system tray, where it will monitor processes and apply CPU affinity as configured inconfig.ini.
- Double-click on
-
Tray Menu:
- Right-click the system tray icon to access the tray menu.
- Reload Config: Reload the
config.inifile to apply any changes. - Exit: Close the program.
-
Monitor Processes:
- The program will continuously monitor running processes and set their CPU affinity based on the configuration. You can stop the program by clicking "Exit" in the tray menu or closing it from the task manager.
The solution is configured for Visual Studio 2019. You can open and build the project using the provided .sln solution file. Debug output will be shown in a console window when compiled in Debug mode.
Though you can just compile main.cpp with any C++ compiler, the project file is provided for convenience.
If you need to debug, the program attaches a debug console (AllocConsole) that outputs logs to the console as well as to the affinity.log file.
This project is licensed under the MIT License - see the LICENSE file for details.