Restrict process(es) to single core

David N davidn04 at gmail.com
Fri Jun 26 18:10:29 UTC 2009


2009/6/27 Chuck Swiger <cswiger at mac.com>:
> On Jun 26, 2009, at 10:40 AM, Daniel Underwood wrote:
>>
>> Suppose I'm running a multi-threaded program that's utilizing both
>> cores of my CPU.  I'm not interested in it's speed, however, and would
>> like to free up another core for general purpose. Is there a way
>> (without altering/recompiling the program, obviously) to restricting a
>> process and its children to a single core?
>
> The simple way would be to use renice to change the process priority; other
> normal processes you run would get CPU first, but this task would be able to
> use all system resources if nothing else is.  I'm not sure whether FreeBSD
> currently has a way to bind tasks to only running on a subset of available
> CPUs (ie, CPUSETs mechanism in Linux, set CPU affinity in Windows, etc).
>
> Regards,
> --
> -Chuck
>
> _______________________________________________
> freebsd-questions at freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "freebsd-questions-unsubscribe at freebsd.org"
>

If you're running FreeBSD 7.1 or up, theres a program called cpuset.
man cpuset

I think that's what you're after. Allows binding of process to certain CPUs.

Regards
David N


More information about the freebsd-questions mailing list