[PATCH 2 of 2] add support for setting worker processes and CPU affinity automatically

Maxim Konovalov maxim at nginx.com
Fri Jan 13 10:15:33 UTC 2012


> [snip]
>
> Thank you very much for the review.
>
>     You use "ngx_ncpu" global variable and for Linux you set it by
>     sysconf(_SC_NPROCESSORS_ONLN).
>
>     On freeBSD and MacOS systems it set by sysctls(hw.ncpu), and it
>     is equal
>     to 1 on others.
>
> Setting CPU affinity is available on Linux systems only. Please
> correct me if I'm wrong.
>
That's wrong.

Just some start points:

FreeBSD: cpuset_setaffinity(2)
Solaris: probably better to start from processor_bind(2) man page.
HP/UP: pset_bind(2), psrset(1m)
AIX: bindprocessor()

Sure other systems with more or less advances *MP support have a
similar functionality.

-- 
Maxim Konovalov
+7 (910) 4293178
http://nginx.com/



More information about the nginx mailing list