Date: Tue, 2 Jun 2009 08:39:00 -0400 From: John Baldwin <jhb@freebsd.org> To: freebsd-smp@freebsd.org Cc: nocturnal <swehack@gmail.com> Subject: Re: Show which CPU is executing a thread? Message-ID: <200906020839.00272.jhb@freebsd.org> In-Reply-To: <9aed80930906010738q1d92ae0fje1a83143092fc100@mail.gmail.com> References: <9aed80930906010357w2bf642abk50bbadb6cdf34196@mail.gmail.com> <9aed80930906010738q1d92ae0fje1a83143092fc100@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Monday 01 June 2009 10:38:39 am nocturnal wrote: > I'm more after a programming API for this and when i search the web all i > find is people saying it cannot be done on FreeBSD in userspace, yet. > > Solaris and Linux can do it but FreeBSD doesn't have this in user space. > > Is anyone working on it, what is the status? Will it be part of SMPng? First of all, why do you need to know this? There are APIs to let you bind yourself to specific CPUs, but there is not a convenient way to figure out which CPU you are on. Probably because unless you bind yourself to a specific CPU, the knowledge is quite useless and racy (you can be preempted in userland at any time and be migrated to another CPU unless you have bound yourself to a CPU). If you do bind yourself to a CPU, then you should know which one you are bound to. :) (And you can also query your binding set.) -- John Baldwin
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200906020839.00272.jhb>