Operating System - HP-UX
1830233 Members
1814 Online
109999 Solutions
New Discussion

Process Binding to 0th processor ,mpctl(0 behaviour.

 
Aniket
New Member

Process Binding to 0th processor ,mpctl(0 behaviour.

It looks like behaviour of mpctl() call is
different on hp11.00 and hp11.11. There is
one patch PHKL_25475 on hp11.00 which is causing a problem in our code.
we have code where we check whether that processor is online or not.

res = mpctl (MPC_GETFIRSTSPU, (spu_t) 0,
(pid_t) 0);

Here mpctl() returns 0 as first available processor. now we assign 'res' to 'pross'.
for (pross=res;
pross<=nprocs ; pross++)
{
result = mpctl (MPC_GETNEXTSPU, (spu_t) (pross-1), (pid_t) 0);
printf("For processor %d, result is %d\n",pross, result);
}
This returns (-1) when pross=0 on hp11.11 and
hp11.00 with patch PHKL_25475.

Eariler without patch PHKL_25475
mpctl(MPC_GETNEXTSPU,pross-1,0) used to return 0 where pross=0;
Is it that 0th processor is not available for process binding on hp11.11 onwards?

Or is it that if 2nd parameter for mpctl(,-1,)
has negative value shud return -1 (as in hp11.11) and not 0(as in hp11.00 with out ptach PHKL_25475). ?

Finally my question remains ..,
Can i bind my process to 0th processor on
hp11.11 or its reserved by OS ?

Thanks in advance,
Aniket.
1 REPLY 1
James Murtagh
Honored Contributor

Re: Process Binding to 0th processor ,mpctl(0 behaviour.

First of all, I don't think this will answer your question really but may help....

Looking at the patch, PHKL_25475, it does alter one object file the mpctl() call is in.....althought doesn't include the mpctl.o object itself.

# grep -il mpctl /usr/conf/lib/*
/usr/conf/lib/libdebug.a
/usr/conf/lib/libpm.a
/usr/conf/lib/libscall.a
# nm /usr/conf/lib/libscall.a |grep mpctl
mpctl | |undef |code |

Putting the full output to a file and you can see the object is init_sent.o, which is included in the patch. Your best bet is to find what patch it superseded and check the symptoms it fixes between the last software level.

In terms of difference between versions, all I can show is this....

HPUX 11.11
# ar -x /usr/conf/lib/libpm.a mpctl.o
# cksum mpctl.o
1283031925 18968 mpctl.o

HPUX 11.00
# ar -x /usr/conf/lib/libpm.a mpctl.o
# cksum mpctl.o
1333892570 51112 mpctl.o

I have had a look and cannot find anything that says you can't schedule processes on the monarch processor.

Lastly, some code to schedule processes....

/* This program takes two inputs...first parameter is the cpu number */
/* to run a system command on and the second is the actual command */
/* enclosed in quotes as follows: */
/* set_processor 2 'date' */


#include
#include
#include
#include

extern errno;
extern char*sys_errlist[];
extern int sys_nerr;

int main(argc, argv)
int argc;
char *argv[];
{
spu_t req_cpu, chosen_cpu;
pid_t pid;
if (argc < 3) {
printf("setprocessor spunum command");
exit(1);
}
req_cpu = atoi(argv[1]);
pid = getpid();
chosen_cpu = mpctl(MPC_SETPROCESS,req_cpu, pid);
if (chosen_cpu == -1) {
printf("error found in mpctl with MPC_setprocess \n");
printf("Error number is 37;d.\n",(errno));
if (errno > 0 && errno < sys_nerr)
printf("Error message is: 37;s.\n",sys_errlist[errno]);
exit(1);
}
printf ("chose_cpu = 37;8d pid = 37;8d\n", chosen_cpu, pid);
sleep(1); /* make sure that we get scheduled on this processor */
printf("CPU# is 37;d\n", mpctl(MPC_GETCURRENTSPU,chosen_cpu,pid));
system(argv[2]);
}