Forums
New posts
Search forums
What's new
New posts
Latest activity
Tutorials
Search titles only
By:
Log in
Register
What's new
Search
Search titles only
By:
Menu
Log in
Register
What's new
Search
Search titles only
By:
New posts
Search forums
Forums
Windows 8 Forums
Tutorials
CPU Affinity Shortcut for a Program - Create in Windows
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Brink" data-source="post: 338183" data-attributes="member: 19"><p style="text-align: center"><span style="font-size: 15px"><strong>How to Create a Shortcut to Run an Application with a Set CPU Affinity in Windows</strong></span></p><p></p><p></p><p><strong><a href="http://en.wikipedia.org/wiki/Processor_affinity">Processor affinity</a></strong> or <strong>CPU Pinning</strong> enables the binding and un-binding of a <strong><a href="http://en.wikipedia.org/wiki/Process_(computing)">process</a></strong> or <strong><a href="http://en.wikipedia.org/wiki/Thread_(computing)">thread</a></strong> to a physical CPU or a range of CPUs, so that the process or thread in question will run only on the CPU or range of CPUs in question, rather than being able to run on any CPU</p><p></p><p>By default, Windows runs an application on all available cores of the processor. If you have a multi-core processor, then this tutorial will show you how to set the<strong> processor affinity</strong> of an application to control which core(s) of the processor the application will run on.</p><p></p><p>If the application and CPU supports <strong><a href="http://en.wikipedia.org/wiki/Symmetric_multiprocessing">Symmetric Multiprocessing (SMP)</a></strong> or <strong><a href="http://en.wikipedia.org/wiki/Hyper-threading">HyperThreading (HT)</a></strong>, then Windows will automatically adjust the application's usage of each processor core for the best performance. You will not gain much, if anything, from manually changing the processor affinity for these type of applications.</p><p></p><p>If you have more then one processor intensive applications running, then you could improve their performance by setting the processor affinity of their processes to run on a different core(s). This way they are not competing for the resources of the same core(s).</p><p></p><p>[line].[/line]</p><p>This tutorial will show you how to create a <strong>shortcut</strong> that will always <strong>run an application</strong> with a set <strong>CPU affinity</strong> by default in XP, Vista, Windows 7, and Windows 8.</p><p></p><p></p><p></p><p><span style="color: #006400"><span style="font-size: 22px"><strong>Here's How:</strong></span></span></p><p></p><p><span style="font-size: 12px"><strong>1.</strong></span> This step will show you how many CPU cores you have, and how to figure the <strong>hex</strong> value to use at <strong>step 3</strong> below for the CPU(s) you want to run the application on.</p><p></p><p><span style="color: #ff0000"><strong>NOTE:</strong></span> If you should need any assistance with this step, then please feel free to post. I'll be happy to help.</p><p></p><p></p><p>A) Open <strong><a href="http://www.eightforums.com/tutorials/5014-task-manager-open-windows-8-a.html">Task Manager</a></strong> (CTRL+Shift+ESC) in more details view, click/tap on the <strong>Processes</strong> (XP, Vista, Windows 7) OR <strong>D<strong>e</strong>tails </strong>(Windows 8) tab, right click or press and hold on any process in the <strong>Name</strong> column, and click/tap on <strong>Set affinity</strong>. (see screenshot below)</p><p></p><p><span style="color: #ff0000"><strong>NOTE:</strong></span> This will show you how many CPU cores you have. I have <strong>12</strong> CPU cores numbered from <strong>0 to 11</strong>.</p><p></p><p>[ATTACH]36479[/ATTACH]</p><p></p><p></p><p>B) For how many CPU cores you have will also be how long the binary number will be. Since I have <strong>12</strong> CPU cores, the binary number will be 12 zeros <strong>000000000000</strong>. Each zero in the binary number represents a CPU core number from right to left. In my case with 12 CPU cores, the <strong>far right 0</strong> in the binary number will be for <strong>CPU 0</strong>, and the <strong>far left 0</strong> will be for <strong>CPU 11</strong>. (see screenshot below)</p><p></p><p>C) For each CPU number you want to run the application on, replace <strong>0</strong> (off) with <strong>1</strong> (on) in the binary number for the CPU numbers.</p><p></p><p>For example, if I wanted to run the application only on <strong>CPU 0</strong>, then my binary number would be changed to <strong>000000000001</strong>. To run the application on <strong>CPU 0</strong> and <strong>CPU 3</strong>, I would use <strong>000000001001</strong>. (see screenshot below)</p><p></p><p>[ATTACH]36487[/ATTACH]</p><p></p><p></p><p>D) Go the website below, and type your <strong>binary number</strong> from step 1C above into the <strong>Binary</strong> field. This will convert the binary number to a <strong>hexadecimal</strong> (hex) that you will need to use at <strong>step 3</strong> below.</p><p></p><p>Website: <a href="http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html">Binary/Decimal/Hexadecimal Converter</a></p><p></p><p></p><p>For example, with my <strong>000000000001 </strong>binary number, I get a <strong>hex</strong> value of <strong>1</strong>. (see screenshot below)</p><p></p><p>[ATTACH]36488[/ATTACH]</p><p></p><p></p><p><strong><span style="font-size: 12px">2.</span></strong> Right click or press and hold on an empty area of your desktop, and click/tap on <strong>New </strong>and<strong> Shortcut</strong>.</p><p></p><p><strong><span style="font-size: 12px">3.</span></strong> Type the command below into the location area, and click/tap on the <strong>Next</strong> button. (see screenshot below)</p><p></p><p></p><p><strong>cmd.exe /c start "<span style="color: #ff0000">Program Name</span>" /affinity<span style="color: #ff0000"> #</span> "<span style="color: #ff0000">Full path of application file</span>"</strong></p><p></p><p></p><p><span style="font-size: 12px"><span style="color: #0000cd"><strong>For example: </strong></span></span>I would type this command below exactly if I wanted to create a shortcut to run <strong>Process Monitor</strong> on only <strong>CPU 0 </strong>(step 1), and it's .exe file is located at "<strong>E:\Programs\Process Monitor 3.05\Procmon.exe</strong>".</p><p></p><p>(For only on CPU 0)</p><p><strong>cmd.exe /c start "<span style="color: #ff0000">Process Monitor</span>" /affinity<span style="color: #ff0000"> 1</span> "<span style="color: #ff0000">E:\Programs\Process Monitor 3.05\Procmon.exe</span>"</strong></p><p></p><p>(For on CPU 0 and CPU 3)</p><p><strong>cmd.exe /c start "<span style="color: #ff0000">Process Monitor</span>" /affinity<span style="color: #ff0000"> 9</span> "<span style="color: #ff0000">E:\Programs\Process Monitor 3.05\Procmon.exe</span>"</strong></p><p></p><p></p><p>[note]Substitute <span style="color: #ff0000"><strong>Program Name </strong></span>in the command with the actual program's name within quotes.</p><p></p><p>Substitute <span style="color: #ff0000"><strong>#</strong></span> in the command for the affinity # with the hex value (ex: 1) from <strong>step 1D</strong> above.</p><p></p><p>Substitute <span style="color: #ff0000"><strong>Full path of application file</strong></span> in the command with the full path of the file within quotes.[/note]</p><p></p><p></p><p>[ATTACH]36474[/ATTACH]</p><p></p><p><strong><span style="font-size: 12px">4.</span></strong> Type any <strong>name</strong> you would like to give the shortcut, and click/tap on the <strong>Finish</strong> button. (see screenshot below)</p><p></p><p>[ATTACH]36475[/ATTACH]</p><p></p><p><strong><span style="font-size: 12px">5.</span></strong> Right click or press and hold on the new shortcut, and click/tap on <strong>Properties</strong>.</p><p></p><p><strong><span style="font-size: 12px">6.</span></strong> Click/tap on the <strong>Shortcut</strong> tab, then click/tap on the <strong>Change Icon</strong> button. (see screenshot below)</p><p></p><p>[ATTACH]36476[/ATTACH]</p><p></p><p><strong><span style="font-size: 12px">7.</span></strong> In the line under "Look for icons in this file", copy and paste the same <span style="color: #ff0000"><strong>full path of the application file</strong></span> used in the shortcut below, and press <strong>Enter</strong>. (see screenshot below)</p><p></p><p><strong>For example:</strong> E:\Programs\Process Monitor 3.05\Procmon.exe</p><p></p><p></p><p>[ATTACH]36477[/ATTACH]</p><p></p><p><strong><span style="font-size: 12px">8.</span></strong> Select (highlight) the icon you want for the shortcut, and click/tap on <strong>OK</strong>. (see screenshot above)</p><p><strong><span style="color: red">NOTE:</span></strong> <em>You can use any icon that you would like instead though</em>.</p><p></p><p><strong><span style="font-size: 12px">9.</span></strong> Click/tap on <strong>OK</strong>. (see screenshot below step 6)</p><p></p><p><strong><span style="font-size: 12px">10.</span></strong> In <strong>Vista</strong> and <strong>Windows 7</strong>, you can now <a href="http://www.sevenforums.com/tutorials/397-taskbar-pin-unpin-program.html"><strong>Pin to Taskbar</strong></a> (Windows 7 only) or <a href="http://www.sevenforums.com/tutorials/744-start-menu-pin-unpin-program.html"><strong>Pin to Start Menu</strong></a>, add to <a href="http://www.sevenforums.com/tutorials/888-quick-launch-enable-disable.html"><strong>Quick Launch</strong></a>, <a href="http://www.vistax64.com/tutorials/74063-keyboard-shortcut.html"><strong>assign a keyboard shortcut</strong></a> to it, or move this shortcut to where you like for easy use.</p><p></p><p><strong><span style="font-size: 12px">11.</span></strong> In <strong>Windows 8</strong>, you can <a href="http://www.eightforums.com/tutorials/4946-taskbar-pin-unpin-apps-windows-8-a.html"><strong>Pin to Taskbar</strong></a> on desktop, <a href="http://www.eightforums.com/tutorials/2352-start-screen-pin-unpin-app-folder-drive-windows-8-a.html"><strong>Pin to Start</strong></a> screen, add to <a href="http://www.eightforums.com/tutorials/5069-quick-launch-add-taskbar-windows-8-a.html"><strong>Quick Launch</strong></a>, <a href="http://www.eightforums.com/tutorials/4999-shortcuts-assign-keyboard-shortcut-windows-8-a.html"><strong>assign a keyboard shortcut</strong></a> to it, or move this shortcut to where you like for easy use.</p><p></p><p></p><p></p><p>That's it,</p><p>Shawn</p><p></p><p></p><p>[rel]</p><ul> <li data-xf-list-type="ul"><a href="http://www.eightforums.com/tutorials/40287-cpu-priority-shortcut-program-create-windows.html">How to Create a Shortcut to Run an Application with a Specific CPU Priority in Windows</a></li> <li data-xf-list-type="ul"><a href="http://www.sevenforums.com/tutorials/83632-processor-affinity-set-applications.html">How to Set Processor Affinity to an Application in Windows 7</a></li> <li data-xf-list-type="ul"><a href="http://www.eightforums.com/tutorials/24086-processor-affinity-set-applications-windows-8-a.html">How to Set Processor Affinity for an Application in Windows 8 and 8.1</a></li> <li data-xf-list-type="ul"><a href="http://www.sevenforums.com/tutorials/83864-processor-affinity-add-set-affinity-context-menu.html">How to Add or Remove "Run with CPU Affinity" to the Context Menu</a></li> </ul><p>[/rel]</p></blockquote><p></p>
[QUOTE="Brink, post: 338183, member: 19"] [CENTER][SIZE=4][B]How to Create a Shortcut to Run an Application with a Set CPU Affinity in Windows[/B][/SIZE][/CENTER] [B][URL='http://en.wikipedia.org/wiki/Processor_affinity']Processor affinity[/URL][/B] or [B]CPU Pinning[/B] enables the binding and un-binding of a [B][URL='http://en.wikipedia.org/wiki/Process_(computing)']process[/URL][/B] or [B][URL='http://en.wikipedia.org/wiki/Thread_(computing)']thread[/URL][/B] to a physical CPU or a range of CPUs, so that the process or thread in question will run only on the CPU or range of CPUs in question, rather than being able to run on any CPU By default, Windows runs an application on all available cores of the processor. If you have a multi-core processor, then this tutorial will show you how to set the[B] processor affinity[/B] of an application to control which core(s) of the processor the application will run on. If the application and CPU supports [B][URL='http://en.wikipedia.org/wiki/Symmetric_multiprocessing']Symmetric Multiprocessing (SMP)[/URL][/B] or [B][URL='http://en.wikipedia.org/wiki/Hyper-threading']HyperThreading (HT)[/URL][/B], then Windows will automatically adjust the application's usage of each processor core for the best performance. You will not gain much, if anything, from manually changing the processor affinity for these type of applications. If you have more then one processor intensive applications running, then you could improve their performance by setting the processor affinity of their processes to run on a different core(s). This way they are not competing for the resources of the same core(s). [line].[/line] This tutorial will show you how to create a [B]shortcut[/B] that will always [B]run an application[/B] with a set [B]CPU affinity[/B] by default in XP, Vista, Windows 7, and Windows 8. [COLOR=#006400][SIZE=6][B]Here's How:[/B][/SIZE][/COLOR] [SIZE=3][B]1.[/B][/SIZE] This step will show you how many CPU cores you have, and how to figure the [B]hex[/B] value to use at [B]step 3[/B] below for the CPU(s) you want to run the application on. [COLOR=#ff0000][B]NOTE:[/B][/COLOR] If you should need any assistance with this step, then please feel free to post. I'll be happy to help. A) Open [B][URL='http://www.eightforums.com/tutorials/5014-task-manager-open-windows-8-a.html']Task Manager[/URL][/B] (CTRL+Shift+ESC) in more details view, click/tap on the [B]Processes[/B] (XP, Vista, Windows 7) OR [B]D[B]e[/B]tails [/B](Windows 8) tab, right click or press and hold on any process in the [B]Name[/B] column, and click/tap on [B]Set affinity[/B]. (see screenshot below) [COLOR=#ff0000][B]NOTE:[/B][/COLOR] This will show you how many CPU cores you have. I have [B]12[/B] CPU cores numbered from [B]0 to 11[/B]. [ATTACH]36479[/ATTACH] B) For how many CPU cores you have will also be how long the binary number will be. Since I have [B]12[/B] CPU cores, the binary number will be 12 zeros [B]000000000000[/B]. Each zero in the binary number represents a CPU core number from right to left. In my case with 12 CPU cores, the [B]far right 0[/B] in the binary number will be for [B]CPU 0[/B], and the [B]far left 0[/B] will be for [B]CPU 11[/B]. (see screenshot below) C) For each CPU number you want to run the application on, replace [B]0[/B] (off) with [B]1[/B] (on) in the binary number for the CPU numbers. For example, if I wanted to run the application only on [B]CPU 0[/B], then my binary number would be changed to [B]000000000001[/B]. To run the application on [B]CPU 0[/B] and [B]CPU 3[/B], I would use [B]000000001001[/B]. (see screenshot below) [ATTACH]36487[/ATTACH] D) Go the website below, and type your [B]binary number[/B] from step 1C above into the [B]Binary[/B] field. This will convert the binary number to a [B]hexadecimal[/B] (hex) that you will need to use at [B]step 3[/B] below. Website: [URL='http://www.mathsisfun.com/binary-decimal-hexadecimal-converter.html']Binary/Decimal/Hexadecimal Converter[/URL] For example, with my [B]000000000001 [/B]binary number, I get a [B]hex[/B] value of [B]1[/B]. (see screenshot below) [ATTACH]36488[/ATTACH] [B][SIZE=3]2.[/SIZE][/B] Right click or press and hold on an empty area of your desktop, and click/tap on [B]New [/B]and[B] Shortcut[/B]. [B][SIZE=3]3.[/SIZE][/B] Type the command below into the location area, and click/tap on the [B]Next[/B] button. (see screenshot below) [B]cmd.exe /c start "[COLOR=#ff0000]Program Name[/COLOR]" /affinity[COLOR=#ff0000] #[/COLOR] "[COLOR=#ff0000]Full path of application file[/COLOR]"[/B] [SIZE=3][COLOR=#0000cd][B]For example: [/B][/COLOR][/SIZE]I would type this command below exactly if I wanted to create a shortcut to run [B]Process Monitor[/B] on only [B]CPU 0 [/B](step 1), and it's .exe file is located at "[B]E:\Programs\Process Monitor 3.05\Procmon.exe[/B]". (For only on CPU 0) [B]cmd.exe /c start "[COLOR=#ff0000]Process Monitor[/COLOR]" /affinity[COLOR=#ff0000] 1[/COLOR] "[COLOR=#ff0000]E:\Programs\Process Monitor 3.05\Procmon.exe[/COLOR]"[/B] (For on CPU 0 and CPU 3) [B]cmd.exe /c start "[COLOR=#ff0000]Process Monitor[/COLOR]" /affinity[COLOR=#ff0000] 9[/COLOR] "[COLOR=#ff0000]E:\Programs\Process Monitor 3.05\Procmon.exe[/COLOR]"[/B] [note]Substitute [COLOR=#ff0000][B]Program Name [/B][/COLOR]in the command with the actual program's name within quotes. Substitute [COLOR=#ff0000][B]#[/B][/COLOR] in the command for the affinity # with the hex value (ex: 1) from [B]step 1D[/B] above. Substitute [COLOR=#ff0000][B]Full path of application file[/B][/COLOR] in the command with the full path of the file within quotes.[/note] [ATTACH]36474[/ATTACH] [B][SIZE=3]4.[/SIZE][/B] Type any [B]name[/B] you would like to give the shortcut, and click/tap on the [B]Finish[/B] button. (see screenshot below) [ATTACH]36475[/ATTACH] [B][SIZE=3]5.[/SIZE][/B] Right click or press and hold on the new shortcut, and click/tap on [B]Properties[/B]. [B][SIZE=3]6.[/SIZE][/B] Click/tap on the [B]Shortcut[/B] tab, then click/tap on the [B]Change Icon[/B] button. (see screenshot below) [ATTACH]36476[/ATTACH] [B][SIZE=3]7.[/SIZE][/B] In the line under "Look for icons in this file", copy and paste the same [COLOR=#ff0000][B]full path of the application file[/B][/COLOR] used in the shortcut below, and press [B]Enter[/B]. (see screenshot below) [B]For example:[/B] E:\Programs\Process Monitor 3.05\Procmon.exe [ATTACH]36477[/ATTACH] [B][SIZE=3]8.[/SIZE][/B] Select (highlight) the icon you want for the shortcut, and click/tap on [B]OK[/B]. (see screenshot above) [B][COLOR=red]NOTE:[/COLOR][/B] [I]You can use any icon that you would like instead though[/I]. [B][SIZE=3]9.[/SIZE][/B] Click/tap on [B]OK[/B]. (see screenshot below step 6) [B][SIZE=3]10.[/SIZE][/B] In [B]Vista[/B] and [B]Windows 7[/B], you can now [URL='http://www.sevenforums.com/tutorials/397-taskbar-pin-unpin-program.html'][B]Pin to Taskbar[/B][/URL] (Windows 7 only) or [URL='http://www.sevenforums.com/tutorials/744-start-menu-pin-unpin-program.html'][B]Pin to Start Menu[/B][/URL], add to [URL='http://www.sevenforums.com/tutorials/888-quick-launch-enable-disable.html'][B]Quick Launch[/B][/URL], [URL='http://www.vistax64.com/tutorials/74063-keyboard-shortcut.html'][B]assign a keyboard shortcut[/B][/URL] to it, or move this shortcut to where you like for easy use. [B][SIZE=3]11.[/SIZE][/B] In [B]Windows 8[/B], you can [URL='http://www.eightforums.com/tutorials/4946-taskbar-pin-unpin-apps-windows-8-a.html'][B]Pin to Taskbar[/B][/URL] on desktop, [URL='http://www.eightforums.com/tutorials/2352-start-screen-pin-unpin-app-folder-drive-windows-8-a.html'][B]Pin to Start[/B][/URL] screen, add to [URL='http://www.eightforums.com/tutorials/5069-quick-launch-add-taskbar-windows-8-a.html'][B]Quick Launch[/B][/URL], [URL='http://www.eightforums.com/tutorials/4999-shortcuts-assign-keyboard-shortcut-windows-8-a.html'][B]assign a keyboard shortcut[/B][/URL] to it, or move this shortcut to where you like for easy use. That's it, Shawn [rel] [LIST] [*][URL='http://www.eightforums.com/tutorials/40287-cpu-priority-shortcut-program-create-windows.html']How to Create a Shortcut to Run an Application with a Specific CPU Priority in Windows[/URL] [*][URL='http://www.sevenforums.com/tutorials/83632-processor-affinity-set-applications.html']How to Set Processor Affinity to an Application in Windows 7[/URL] [*][URL='http://www.eightforums.com/tutorials/24086-processor-affinity-set-applications-windows-8-a.html']How to Set Processor Affinity for an Application in Windows 8 and 8.1[/URL] [*][URL='http://www.sevenforums.com/tutorials/83864-processor-affinity-add-set-affinity-context-menu.html']How to Add or Remove "Run with CPU Affinity" to the Context Menu[/URL] [/LIST] [/rel] [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Windows 8 Forums
Tutorials
CPU Affinity Shortcut for a Program - Create in Windows
Menu
Log in
Register
Install the app
Install
Forums
What's new
Log in
Register
Search
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.
Accept
Learn more…
Top