Binds or unbinds kernel threads to a processor.
#include <sys/processor.h>
int bindprocessor (What, Who, Where) int What; int Who; cpu_t Where;
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.
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.
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. |
The bindprocessor kernel service can be called from the process environment only.
The bindprocessor kernel service is part of the Base Operating System (BOS) Runtime.
The bindprocessor command.
The exec subroutine, fork subroutine, sysconf subroutine.