Thread Affinity structure
Mulyadi Santosa
mulyadi.santosa at gmail.com
Sat Feb 5 08:56:33 EST 2011
Hi :)
On Sat, Feb 5, 2011 at 00:11, Sri Ram Vemulpali <sri.ram.gmu06 at gmail.com> wrote:
> Hi all,
>
> I have doubt regarding how the thread affinity (to processor) is
> defined in a process (task). If there is only single thread in a
> process, then when process calls itself on binding to a core, will let
> run on that core forever. But, what if there are multiple threads, in
> a process (task). If the main thread calls set affinity to a core, is
> it going to get inherited to all other threads, or just the calling
> thread in a task. What happens when forked a process with threads that
> has affinity to a core.
AFAIK, forked process (or thread) initially inherit the affinity
property of the parent process. As for thread, I think kernel will
make as long as possible (or maybe forbid) the thread to have
different affinity. The reason could be to avoid too many cache
invalidation / ping pong between cores.
--
regards,
Mulyadi Santosa
Freelance Linux trainer and consultant
blog: the-hydra.blogspot.com
training: mulyaditraining.blogspot.com
More information about the Kernelnewbies
mailing list