I do not know about the native .NET function that can provide this. But if you are ready to use P / Invoke and are running Windows 2003, Vista or later, you can call GetCurrentProcessorNumber .
Of course, this will give you only the processor (kernel) that runs the thread on this particular time fragment, and the next time the thread is scheduled, it can run on a completely different core, even if the OS tends to schedule the thread on the same core for reasons of performance.
source share