[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]
Technical Reference: Kernel and Subsystems, Volume 1
bindprocessor Kernel Service
Purpose
Binds or unbinds kernel threads to a processor.
Syntax
#include <sys/processor.h>
int bindprocessor ( What, Who, Where)
int What;
int Who;
cpu_t Where;
Parameters
What |
Specifies whether a process or a kernel thread is being bound to
a processor. The What parameter can take one of the
following values:
- BINDPROCESS
- A process is being bound to a processor.
- BINDTHREAD
- A kernel thread is being bound to a processor.
|
Who |
Indicates a process or kernel thread identifier, as appropriate for
the What parameter, specifying the process or kernel
thread which is to be bound to a processor. |
Where |
If the Where parameter is in the range 0-n (where n is the number of processors
in the system), it represents a logical processor identifier to which the
process or kernel thread is to be bound. Otherwise, it represents a processor
class, from which a processor will be selected. A value of PROCESSOR_CLASS_ANY unbinds the specified process or kernel thread,
which will then be able to run on any processor. |
Description
The bindprocessor kernel service
binds a single kernel thread, or all kernel threads in a process, to a processor,
forcing the bound threads to be scheduled to run on that processor only.
It is important to understand that a process itself is not bound, but rather
its kernel threads are bound. Once kernel threads are bound, they are always
scheduled to run on the chosen processor, unless they are later unbound. When
a new thread is created using the thread_create kernel
service, it has the same bind properties as its creator.
Return Values
On successful completion, the bindprocessor kernel service returns 0. Otherwise, a value of -1 is returned and
the error code can be checked by calling the getuerror kernel service.
Error Codes
The bindprocessor kernel service
is unsuccessful if one of the following is true:
EINVAL |
The What parameter is invalid, or the Where parameter indicates an invalid processor number
or a processor class which is not currently available. |
ESRCH |
The specified process or thread does not exist. |
EPERM |
The caller does not have root user authority, and the Who parameter specifies either a process, or a thread belonging to a
process, having a real or effective user ID different from that of the calling
process. |
Execution Environment
The bindprocessor kernel service
can be called from the process environment
only.
Related Information
The bindprocessor command.
The exec subroutine, fork
subroutine, sysconf subroutine.
[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home |
Legal |
Search ]