processor_bind man page on Tru64

Man page or keyword search:  
man Server   12896 pages
apropos Keyword Search (all sections)
Output format
Tru64 logo
[printable version]

processor_bind(3)					     processor_bind(3)

NAME
       processor_bind - Binds a process to a processor

SYNOPSIS
       #include	 <sys/types.h>	#include <sys/processor.h> #include <sys/proc‐
       set.h>

       int processor_bind(
		idtype_t idtype,
		id_t pid,
		processorid_t processorid,
		processorid_t *obind );

LIBRARY
       SVR4 Library (libsvr4)

OPERANDS
       The enumeration type idtype_t defined in sys/procset.h is used to indi‐
       cate what type of id is being specified.	 Input parameter for a process
       id, process group id, session id, scheduling class id, user  id,	 or  a
       group id.  Type for processor name or CPU number.

DESCRIPTION
       The  processor_bind() function binds a process to a specific processor.
       The idtype must be set to P_PID and the pid is a process ID  specifying
       the  process  to	 be  bound. When the process identified by the pid has
       been bound it will execute only on the processor specified  by  proces‐
       sorid  (even if other processors are available), except briefly, if the
       process requires a resource which only another processor	 can  provide.
       The  processor  may  continue to run other processes in addition to the
       one specified by pid. The processor_bind() function call will  fail  if
       the  process specified by pid is bound exclusively to another processor
       or if there are already processes exclusively bound  to	the  processor
       specified by processorid.

       If  processorid	is  PBIND_NONE, the specified process is unbound; that
       is, it is made free to run on any processor.

       If the process specified by pid is already bound to a different proces‐
       sor,  the  binding  for	that  process will be changed to the processor
       specified by processorid.  If obind is not NULL and the process is cur‐
       rently bound to a   processor, the processor is returned by obind.

       The  bind  state	 of a process is inherited by any children caused by a
       fork(2) call and does not change across a call to exec(2).

       In order to bind or unbind a process, the real or effective user ID  of
       the  caller  must match the real or saved (from exec(2)) user ID of the
       process being bound or unbound, or the  caller  must  have  super  user
       privileges.

NOTES
       Some  of the files that are referenced by absolute path in the System V
       Environment for Tru64 UNIX reference pages actually may be located rel‐
       ative to /usr/opt/svr4.

RESTRICTIONS
       This  function is thread-safe.  However, since it affects global system
       conditions, calling it  from  multiple  threads	can  cause  unexpected
       results.

RETURN VALUES
       Success.	 On failure SVE -- API sets errno to approriate value.

ERRORS
       Failure	may result from: The calling process does not have appropriate
       privileges.  An invalid idtype or processorid  was  specified,  or  the
       specified  processor  is	 off  line.   No  process  can be found with a
       process ID of pid.  The process specified by pid is  bound  exclusively
       to  another  processor or there are already processes exclusively bound
       to the processor specified by processorid.  The obind  process  is  not
       NULL and points to an invalid address.

EXAMPLES
       This will bind the current process to processor #1.

	      #include	<stdio.h>  #include <errno.h> #include <sys/sysinfo.h>
	      #include <processor.h> #include <mach/kern_return.h>

	      main() {
		      int x;
		      pid_t pid;

		      pid = getpid();
		      x = processor_bind(0, pid, 1, &obind);
		      if(x < 0)
			      perror("processor_bind");
		      else {
			  printf("processor_bind returned %d\n",x);
			  printf("obind is %d\n",obind);
		      }
		      exit(0); }

	      This will bind process with pid 100 to processor #5.

	      #include <stdio.h> #include <errno.h>  #include  <sys/sysinfo.h>
	      #include <processor.h> #include <mach/kern_return.h>

	       main() {
		      int x;

		      x = processor_bind(0, 100, 5, &obind);
		      if(x < 0)
			      perror("processor_bind");
		      else {
			  printf("processor_bind returned %d\n",x);
			  printf("obind is %d\n",obind);
		      }
		      exit(0); }

	      If  the  process	is  already  bound, then the processor will be
	      returned by obind.

SEE ALSO
       Functions: fork(2), exec(2)

							     processor_bind(3)
[top]
                             _         _         _ 
                            | |       | |       | |     
                            | |       | |       | |     
                         __ | | __ __ | | __ __ | | __  
                         \ \| |/ / \ \| |/ / \ \| |/ /  
                          \ \ / /   \ \ / /   \ \ / /   
                           \   /     \   /     \   /    
                            \_/       \_/       \_/ 
More information is available in HTML format for server Tru64

List of man pages available for Tru64

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net