如何找到在处理器上我的线程在C#中运行? [英] How do I find the processor on which my thread is running in C#?

查看:117
本文介绍了如何找到在处理器上我的线程在C#中运行?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何找到处理器上我的线程在C#中运行

How do I find the processor on which my thread is running in C#?

推荐答案

这并不一定是恒定的? - 该线程可以调度到跨越其生命周期不同的内核。您可以设置亲和力口罩,如果你想对一个特定线程关联到一个特定的CPU。见Thread.BeginThreadAffinity ,在 API文档什么可以在净做更多的细节。

This is not necessarily a constant - the thread could be scheduled onto different cores across its lifetime. You can set affinity masks to tie a particular thread to a particular CPU if you want to. See the API docs for Thread.BeginThreadAffinity for more details on what can be done within .Net.

这篇关于如何找到在处理器上我的线程在C#中运行?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆