running code on all CPUs

David Xu davidxu at freebsd.org
Fri Oct 6 16:38:19 PDT 2006


On Friday 06 October 2006 21:45, Stanislav Sedov wrote:
> > AFAIK, you can use scheduler API, the sched_bind() moves current thread
> > to a specific CPU, hope this helps.
>
> You can find examples e.g. in hwpmc driver. Just grep by sched_bin.
>
> --
> Stanislav Sedov          <stas at FreeBSD.org>        [[Россия, Москва]]
> PGP id: 0xEB269581       http://people.freebsd.org/~stas/stas.key.asc

sched_pin is different than sched_bind, sched_pin only pins current thread on
current cpu, but sched_bind allows a thread to migrate to another CPU, after
the sched_bind returns, the thread should already be running on the specified
CPU, it makes it possible that  a thread can iterate through all available
CPUs.

David Xu


More information about the freebsd-hackers mailing list