Operating System - HP-UX
1833758 Members
2575 Online
110063 Solutions
New Discussion

Re: C Programming question

 
S.T.Arun
New Member

C Programming question

Hi,
I want my (user) process to be attached to a specific processor in a multiprocessor system (4 CPUs). If I have 3 processes (p1, p2, p3) and CPUs (c1, c2, c3, c4), I want process p1 to run only on c1, p2 on c2 etc.

Is this possible? Any kind of pointers will help me. Thank you in advance.

Arun.
5 REPLIES 5
T G Manikandan
Honored Contributor

Re: C Programming question

To my knowledge I don't think you can attach a process to a specific processor.

There are some openview tools from hp which can allocate some amount of % usage of CPU to a process or user.

The tool is the Process Resource Manager.

Just find some information at
http://docs.hp.com/hpux/onlinedocs/B8733-90007/B8733-90007.html

Thanks
Stefan Farrelly
Honored Contributor

Re: C Programming question

see manpage for;

pthread_processor_bind_np(3T) pthread_processor_bind_np(3T)
Pthread Library

NAME
pthread_num_processors_np(), pthread_processor_bind_np(),
pthread_processor_id_np() - determine how many processors are
installed in the system, bind threads to processors, and determine
processor IDs; respectively.

Im from Palmerston North, New Zealand, but somehow ended up in London...
David Johns
Advisor

Re: C Programming question

Hi:

Some code was posted a while back that may do what you want:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xdcbb3a7b3682d611abdb0090277a778c,00.html

If the link doesn't work, search the forums on 11i mpctl.

-Dave
Bill McNAMARA_1
Honored Contributor

Re: C Programming question

yea, you'll need this patch + dependencies for 11i:

http://support4.itrc.hp.com/service/patch/patchDetail.do?patchid=PHKL_24578&context=hpux:800:11:11

Later,
Bill
It works for me (tm)
Steven Gillard_2
Honored Contributor

Re: C Programming question

You can also do this non-programmatically on 11i using the mpsched(1) command:

$ mpsched -c1 ./p1

This will bind the p1 command to SPU 1. Remember the SPU numbers start at 0.

See the man page for more info.

Regards,
Steve