 |
 |
|
 |
|
online multimedia
presentations:
crisis management team performance
troubleshooting - Ken Johnson
For more
information, go to hp
experts present within planning, design, and
implementation of the IT resource center.
| |
|
 |
|
 |
 |
|
 |
|
 |
HP engineer |
 |
expert in this area |
|
user status |
 |
ITRC Pro |
250 points |
 |
ITRC Graduate |
500 points |
 |
ITRC Wizard |
1000 points |
 |
ITRC Royalty |
2500 points | |
|
 |
how
to earn points |
|
question status |
 |
Magical
Answer |
Message with a response that solved the author's
question | | |
|
 |
|
 | |
 |
forums
> hp-ux
> workload/resource
management > Assign a process to a processor |
|
|
author |
subject: Assign a process to a processor |
Matteo
Pignoni
|
June 07, 2001 20:27 PM GMT |
|
Hi! Is it possible to assign a process to a
processor? For example if I have a server with 4 processor, can
I decide to execute a process only in the CPU #3 ? Thanks.
|
Note: If you are
the author of this question and wish to assign points to any of the
answers, please login first. Click here
for more information on assigning points. |
Sort Answers By:
Date or Points
|
James
R. Ferguson
|
June 07, 2001 20:32 PM
GMT [ 10 pts ]
|
|
Hi:
Take a look at PRM (Process Resource
Manager) for this. Here's a link to the guide:
http://docs.hp.com/hpux/onlinedocs/B8733-90005/B8733-90005.html
...JRF... |
Patrick
Wallek
|
June 07, 2001 21:06 PM
GMT [ unassigned ]
|
|
Here's some more information on PRM. This includes
pricing info.
http://www.software.hp.com/cgi-bin/swdepot_parser.cgi/cgi/displayProductInfo.pl?productNumber=B3835CA
|
Bill
McNAMARA
|
June 08, 2001 13:15 PM
GMT [ unassigned ]
|
|
This one is free.. instructions below
Later, Bill
=======================================================================
Program to set processor affinity: (setproc.c)
-------------------------------------------------------------------------
#include <stdio.h> #include <sys/types.h>
#include <sys/syscall.h> #include <sys/mp.h>
#include <grp.h>
main(argc,argv) int argc;
char *argv[]; { gid_t sgid; int i; int pid;
if (argc < 2) { printf("Usage: setproc spunum pid0
[pid1 ... pidn]\n"); exit(1); } sgid = atoi (argv[1]);
i = argc; printf("Attempting to set process affinity for
processor %d\n", sgid); while (i-- >2) { pid =
atoi(argv[i]); if ((sgid = SETPROCESS(sgid, pid)) < 0)
perror("setprocess failed"); printf ("processor %d pid =
%d\n", sgid, pid); } }
-------------------------------------------------------------------------
Compile the above program with
cc -o setproc
setproc.c
The following shell script can be used to test
that processor affinity is working correctly:
--------------------------------------------------------------------
#!/bin/ksh
echo process id = $$ i=1
while [
"$i" -lt 10000 ] do echo " $i\r\c" i=`expr $i + 1`
sleep 1 done
--------------------------------------------------------------------
You can start an instance of this script and use the setproc
program on a dual processor system to switch processes between
processors. You should run this on a seperate terminal since it
will send the count to the terminal every second.
You
can then use the setproc program to move the process between
processors.
Usage:
setproc 0 <pid>
to force to process <pid> to processor 0, or use
setproc 1 <pid>
to force process <pid>
to processor 1, etc.
|
John
Bolene
|
June 08, 2001 15:05 PM
GMT [ unassigned ]
|
|
As Bill wisely said, you can dedicate a process to
a processor, but you must have access to the source code and be able
to compile it.
PRM is the only way that I know how to do it
if you only have an executable binary file. |
Carsten
Krege
|
June 08, 2001 16:32 PM
GMT [ unassigned ]
|
|
With PRM you CANNOT force a process to run on a
specific CPU. PRM can be used to ensure that a process (specifically
a PRM group consisting of one ore more processes) cannot use more
than a specific percentage of the total CPU resource (in times of
high workload). The processes are not forced to run on a specific
CPU though. THis would break many programs.
This can only be
achieved with a program like Bill uses and which can force any PID
to run on one specific CPU (ie you don't need the programs source),
done by SETPROCESS which is a mpctl() system call.
Carsten |
John
Bolene
|
June 08, 2001 19:14 PM
GMT [ unassigned ]
|
|
Darn, every once in awhile you make a mistake.
Looks like this is my day. I'll go to the doghouse for the
rest of the day. |
|