From: "Steve Graegert" <graegerts@gmail.com>
To: Xu Yang <risingsunxy@googlemail.com>
Cc: linux-c-programming@vger.kernel.org
Subject: Re: looking for a function
Date: Tue, 16 Sep 2008 16:03:13 +0200 [thread overview]
Message-ID: <6a00c8d50809160703mc47c47cy779625c0d2f4c1c9@mail.gmail.com> (raw)
In-Reply-To: <ab40e9c0809160626o1cc6e7en5e09650a1d04affe@mail.gmail.com>
Xu Yang,
On Linux sched_getcpu(3) comes to mind. This function is not
particularly useful since the information returned by the function
might not be correct at the point of its return as threads can be
switched to other CPUs (read: cores) at anytime (although CPU/core
switching can be quite expensive due to cache line bouncing for
instance)
So, once the information has been obtained it might already be
obsolete. Anyway, I hope that is what you're looking for.
\Steve
--
Steve Grägert
On Tue, Sep 16, 2008 at 3:26 PM, Xu Yang <risingsunxy@googlemail.com> wrote:
>
> Hi guys,
>
> I am looking for a function that can show me the current thread is
> running on which cpu.
>
> e.g I am using pthread to write a multithreaded program, in each
> thread I would like to insert such kind of function so that I can know
> on which cpu this thread is running on.
>
> which function should be used?
>
> thanks for the help!!
>
> best regards,
>
>
>
> Yang
> --
> To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-c-programming" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-09-16 14:03 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-16 13:26 looking for a function Xu Yang
2008-09-16 14:03 ` Steve Graegert [this message]
[not found] ` <6a00c8d50809160701v2cf11b93ta86c30398cfe2e6b@mail.gmail.com>
2008-09-16 14:14 ` Xu Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=6a00c8d50809160703mc47c47cy779625c0d2f4c1c9@mail.gmail.com \
--to=graegerts@gmail.com \
--cc=linux-c-programming@vger.kernel.org \
--cc=risingsunxy@googlemail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).