Messages in this thread | | | Date | Sun, 03 Oct 1999 22:04:54 +0200 | From | Avi Kivity <> | Subject | Re: [PATCH] Binding processes to selected CPUs |
| |
Avi Kivity wrote: > > This patch, against 2.3.18ac8, allows a process to specify which CPUs it > may execute on. It provides functionality similar to NT's ``thread > affinity''. > Oh, and the following programlet demonstrates this feature:
$ bindcpu --> displays the cpus bound to the current process
$ bindcpu mask-in-decimal command args... --> execs command after binding it to the processors specified in mask.
Note that cpu bindings are inherited on fork().
#include <sys/prctl.h> #include <stdio.h> #include <unistd.h>
int main(int ac, char** av, char** ep) { if (ac == 1) { unsigned long binding = 0; prctl(PR_GET_CPUBINDING, &binding); printf("CPU binding: %08lX\n", binding); } else { unsigned long binding = atoi(av[1]); prctl(PR_SET_CPUBINDING, binding); execve(av[2], av+2, ep); } return 0; }
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |