How to find which core your thread is scheduled on?
this post is short and quit simple,
it deal with technique of finding out which core attached to the current thread.
in general finding the core is a matter of diagnostic, it may give some insights like
whether we are using the CPU cache line in optimal way.
the simplest way (and a very recommended one) is to profile your application
using the Visual Studio Concurrent Profiler (which available on VS 2010 ultimate).
in case that you have the need of finding the attached core at runtime from C# code,
you can PInvoke GetCurrentProcessorNumber as shown in the following snippet:
also available at: http://codepaste.net/un731f
do not assume that single thread will be schedule on single core,
thread may switch cores after context switching.
this technique is also limited for Windows Vista and above.