Re: which processor is a thread executing on?
Re: which processor is a thread executing on?
- Subject: Re: which processor is a thread executing on?
- From: Terry Lambert <email@hidden>
- Date: Wed, 01 Oct 2008 21:54:49 -0700
On Oct 1, 2008, at 5:10 PM, Nick Brandaleone <email@hidden> wrote:
I am writing a multi-threaded app, and I would like to know which
processor the thread is executing on.
Is there a pthread function call to determine this?
Dtrace will tell you which processor something is running on at the
time you hit a trace point. You can get the same information via XRay
instruments, and Shark traces can also be used to get it.
A program thread itself can not ask. In part this is because the
asking would require a system call, and that would only tell you the
CPU that the system call happened on. In part it's because power
management takes CPUs offline and online all the time, as needed; this
is the same reason we do not permit binding threads to particular
CPUs: it would not do you much good to bind a thread to a CPU that was
subsequently powered down.
-- Terry
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-kernel mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden