<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Assign a Process to a Specific Processor in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214457#M900409</link>
    <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Thanks for your responses.  I've been tooling with the mpctl call and I'm a little confused.  I call it to assign a PID to an SPU and it returns the SPU number that I am passing, but when I inspect the process it's not where I think it should be.  My process started on processor 1 and ended on 0.  Why didn't it move to processor 4?  Here's my simple minded code:&lt;BR /&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;main( argc, argv, envp )&lt;BR /&gt;    int   argc;&lt;BR /&gt;    char *argv[];&lt;BR /&gt;    char *envp[];&lt;BR /&gt;{&lt;BR /&gt;int retVal;&lt;BR /&gt;printf("%u\n",getpid());&lt;BR /&gt;system("ps -ef|grep zzdx8n &amp;gt; t1.out");&lt;BR /&gt;retVal=mpctl(MPC_GETNUMSPUS);&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;retVal=mpctl(MPC_GETCURRENTSPU);&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;retVal=mpctl(MPC_SETPROCESS_FORCE,4,getpid());&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;sleep(1);&lt;BR /&gt;retVal=mpctl(MPC_GETCURRENTSPU);&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;system("ps -ef|grep zzdx8n &amp;gt;&amp;gt; t1.out");&lt;BR /&gt;retVal=mpctl(MPC_GETCURRENTSPU);&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here's the output file:&lt;BR /&gt;&lt;BR /&gt;zzdx8n  2492 25134  1 08:45:01 ttyp3  0:00 ./t1&lt;BR /&gt;  zzdx8n  2493  2492  1 08:45:01 ttyp3     0:00 sh -c ps -ef|grep zzdx8n &amp;gt; t1.out&lt;BR /&gt;  zzdx8n  2494  2493  5 08:45:01 ttyp3     0:00 ps -ef&lt;BR /&gt;  zzdx8n  2492 25134  0 08:45:01 ttyp3     0:00 ./t1&lt;BR /&gt;  zzdx8n  2496  2492  1 08:45:02 ttyp3     0:00 sh -c ps -ef|grep zzdx8n &amp;gt;&amp;gt; t1.out&lt;BR /&gt;  zzdx8n  2498  2496  0 08:45:02 ttyp3     0:00 grep zzdx8n&lt;BR /&gt;  zzdx8n  2497  2496  2 08:45:02 ttyp3     0:00 ps -ef&lt;/STDIO.H&gt;&lt;/SYS&gt;&lt;/SYS&gt;&lt;/SYS&gt;&lt;/SYS&gt;</description>
    <pubDate>Fri, 12 Mar 2004 08:53:40 GMT</pubDate>
    <dc:creator>Tom Jackson</dc:creator>
    <dc:date>2004-03-12T08:53:40Z</dc:date>
    <item>
      <title>How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214448#M900400</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Can someone tell me if its possible to assign a process to a specific processor on a multi processor system?&lt;BR /&gt;&lt;BR /&gt;I'm running HP-UX 11.0 on an N Class server.&lt;BR /&gt;&lt;BR /&gt;Thanks,&lt;BR /&gt;&lt;BR /&gt;Tom</description>
      <pubDate>Wed, 10 Mar 2004 06:58:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214448#M900400</guid>
      <dc:creator>Tom Jackson</dc:creator>
      <dc:date>2004-03-10T06:58:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214449#M900401</link>
      <description>Hi Tom,&lt;BR /&gt;&lt;BR /&gt;I think you will need something like PRM (process resource manager), take a look at next link.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B3835DATRY" target="_blank"&gt;http://www.software.hp.com/portal/swdepot/displayProductInfo.do?productNumber=B3835DATRY&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;Hope this helps,&lt;BR /&gt;Robert-Jan</description>
      <pubDate>Wed, 10 Mar 2004 07:05:10 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214449#M900401</guid>
      <dc:creator>Robert-Jan Goossens</dc:creator>
      <dc:date>2004-03-10T07:05:10Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214450#M900402</link>
      <description>Hi Tom&lt;BR /&gt;&lt;BR /&gt;this is for 10.2&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000024603782" target="_blank"&gt;http://www1.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000024603782&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;i am not sure about 11.0</description>
      <pubDate>Wed, 10 Mar 2004 07:11:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214450#M900402</guid>
      <dc:creator>Ravi_8</dc:creator>
      <dc:date>2004-03-10T07:11:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214451#M900403</link>
      <description>Hi Tom,&lt;BR /&gt;&lt;BR /&gt;HP-UX 11i supports PSETs, which would do what you want.  You can use PRM to set it up or you could use the psrset command.&lt;BR /&gt;&lt;BR /&gt;Dan&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Mar 2004 14:11:00 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214451#M900403</guid>
      <dc:creator>Dan Herington</dc:creator>
      <dc:date>2004-03-11T14:11:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214452#M900404</link>
      <description>We actually use pbind... but I can't for the life of me&lt;BR /&gt;remember from whence it came. I've attached a gzipped binary.&lt;BR /&gt;(In case you'd like to give it a try)&lt;BR /&gt;&lt;BR /&gt;I looked for the source, depot, or package, to no avail.&lt;BR /&gt;(I will find this... and post again later)&lt;BR /&gt;&lt;BR /&gt;We've simply copied around as needed. Works just fine.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Usage is simple.&lt;BR /&gt;To bind:&lt;BR /&gt;pbind -b PROCID PID&lt;BR /&gt;&lt;BR /&gt;To query:&lt;BR /&gt;pbind -q PID&lt;BR /&gt;&lt;BR /&gt;To UNbind:&lt;BR /&gt;pbind -u PID&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Mar 2004 15:43:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214452#M900404</guid>
      <dc:creator>Chris Watkins_1</dc:creator>
      <dc:date>2004-03-11T15:43:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214453#M900405</link>
      <description>Actually, if you know a little C this is rather easy. The mpctl() system call will do this either for the calling process or another process if the user has permissions. Man mpctl for details.&lt;BR /&gt;</description>
      <pubDate>Thu, 11 Mar 2004 16:42:32 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214453#M900405</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-03-11T16:42:32Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214454#M900406</link>
      <description>C is definitely a skill I want to acquire.&lt;BR /&gt;(Beyond simple "hello world" and "system" calls, that is)&lt;BR /&gt;&lt;BR /&gt;I did a truss on the pbind command we use, and it does&lt;BR /&gt;indeed simply call mpctl functions to do its dirty work.&lt;BR /&gt;Thanks.&lt;BR /&gt;&lt;BR /&gt;(And no points here, please)</description>
      <pubDate>Thu, 11 Mar 2004 16:54:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214454#M900406</guid>
      <dc:creator>Chris Watkins_1</dc:creator>
      <dc:date>2004-03-11T16:54:09Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214455#M900407</link>
      <description>If you can read Chinese (or even if you cant),   there is an example at the following link of using the mpctl function to create a small progrma which works like pbind.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.cbronline.com/currentnews/84088db57bc626a780256e35003855e6" target="_blank"&gt;http://www.cbronline.com/currentnews/84088db57bc626a780256e35003855e6&lt;/A&gt;</description>
      <pubDate>Thu, 11 Mar 2004 17:45:31 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214455#M900407</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2004-03-11T17:45:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214456#M900408</link>
      <description>If you can read Chinese (or even if you cant),   there is an example at the following link of using the mpctl function to create a small progrma which works like pbind.&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://www.hp.com.tw/ssn/unix/0208/unix020803.asp" target="_blank"&gt;http://www.hp.com.tw/ssn/unix/0208/unix020803.asp&lt;/A&gt;</description>
      <pubDate>Thu, 11 Mar 2004 17:45:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214456#M900408</guid>
      <dc:creator>James A. Donovan</dc:creator>
      <dc:date>2004-03-11T17:45:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214457#M900409</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;Thanks for your responses.  I've been tooling with the mpctl call and I'm a little confused.  I call it to assign a PID to an SPU and it returns the SPU number that I am passing, but when I inspect the process it's not where I think it should be.  My process started on processor 1 and ended on 0.  Why didn't it move to processor 4?  Here's my simple minded code:&lt;BR /&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;SYS&gt;&lt;BR /&gt;#include &lt;STDIO.H&gt;&lt;BR /&gt;main( argc, argv, envp )&lt;BR /&gt;    int   argc;&lt;BR /&gt;    char *argv[];&lt;BR /&gt;    char *envp[];&lt;BR /&gt;{&lt;BR /&gt;int retVal;&lt;BR /&gt;printf("%u\n",getpid());&lt;BR /&gt;system("ps -ef|grep zzdx8n &amp;gt; t1.out");&lt;BR /&gt;retVal=mpctl(MPC_GETNUMSPUS);&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;retVal=mpctl(MPC_GETCURRENTSPU);&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;retVal=mpctl(MPC_SETPROCESS_FORCE,4,getpid());&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;sleep(1);&lt;BR /&gt;retVal=mpctl(MPC_GETCURRENTSPU);&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;system("ps -ef|grep zzdx8n &amp;gt;&amp;gt; t1.out");&lt;BR /&gt;retVal=mpctl(MPC_GETCURRENTSPU);&lt;BR /&gt;printf("%u\n",retVal);&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here's the output file:&lt;BR /&gt;&lt;BR /&gt;zzdx8n  2492 25134  1 08:45:01 ttyp3  0:00 ./t1&lt;BR /&gt;  zzdx8n  2493  2492  1 08:45:01 ttyp3     0:00 sh -c ps -ef|grep zzdx8n &amp;gt; t1.out&lt;BR /&gt;  zzdx8n  2494  2493  5 08:45:01 ttyp3     0:00 ps -ef&lt;BR /&gt;  zzdx8n  2492 25134  0 08:45:01 ttyp3     0:00 ./t1&lt;BR /&gt;  zzdx8n  2496  2492  1 08:45:02 ttyp3     0:00 sh -c ps -ef|grep zzdx8n &amp;gt;&amp;gt; t1.out&lt;BR /&gt;  zzdx8n  2498  2496  0 08:45:02 ttyp3     0:00 grep zzdx8n&lt;BR /&gt;  zzdx8n  2497  2496  2 08:45:02 ttyp3     0:00 ps -ef&lt;/STDIO.H&gt;&lt;/SYS&gt;&lt;/SYS&gt;&lt;/SYS&gt;&lt;/SYS&gt;</description>
      <pubDate>Fri, 12 Mar 2004 08:53:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214457#M900409</guid>
      <dc:creator>Tom Jackson</dc:creator>
      <dc:date>2004-03-12T08:53:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214458#M900410</link>
      <description>Well, TOM the first thing that I notice is your assumption that the processor id's go in 0,1,2,3, ... order.&lt;BR /&gt;&lt;BR /&gt;Your really have to do&lt;BR /&gt;a&lt;BR /&gt;first_id = mpctl(MPC_GETFIRSTSPU_SYS,(spu_t) 0,(pid_t) 0);&lt;BR /&gt;you then enter a loop using &lt;BR /&gt;curr_id = next_id = first_id&lt;BR /&gt;while (next_id &amp;gt;= 0)&lt;BR /&gt;  {&lt;BR /&gt;    next_id = mpctl(MPC_GETNEXTSPU_SYS,(spu_t) curr_id,(pid_t) 0);&lt;BR /&gt;    if (next_id &amp;gt;= 0)&lt;BR /&gt;      {&lt;BR /&gt;        curr_id = next_id;&lt;BR /&gt;      }&lt;BR /&gt;  }&lt;BR /&gt;&lt;BR /&gt;You really have to build up an array (or list) of vaslid id's rather than blindly sending in 4.&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Mar 2004 10:37:08 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214458#M900410</guid>
      <dc:creator>A. Clay Stephenson</dc:creator>
      <dc:date>2004-03-12T10:37:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to Assign a Process to a Specific Processor</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214459#M900411</link>
      <description>Hi Clay:&lt;BR /&gt;&lt;BR /&gt;Thanks for your response.  I'm not sure listing the SPU numbers helped, however, I'm convinced that the call is working properly.  My SPUs are numbered 0-7, and the MCP_SETPROCESS_FORCE command is moving the process to another processor.  The ps command may not have been showing the correct SPU number.  When I used the top command, it showed the SPU that I expected.  I also did a couple MCP_SETPROCESS_FORCE commands and saw the process move with the top command.&lt;BR /&gt;&lt;BR /&gt;I had to remove the "_SYS" from your request argument to get it to compile.&lt;BR /&gt;&lt;BR /&gt;Thanks again!&lt;BR /&gt;&lt;BR /&gt;TOM&lt;BR /&gt;</description>
      <pubDate>Fri, 12 Mar 2004 11:21:16 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-assign-a-process-to-a-specific-processor/m-p/3214459#M900411</guid>
      <dc:creator>Tom Jackson</dc:creator>
      <dc:date>2004-03-12T11:21:16Z</dc:date>
    </item>
  </channel>
</rss>

