Process ProcessThread Thread
2024-10-20 15:53:23
Process
ProcessThread:
Process
and ProcessThread
objects have a ProcessorAffinity
property of IntPtr
type that can be directly manipulated to read/change affinity for up to 64 processors:
using System.Diagnostics;
...
Process Proc = Process.GetCurrentProcess();
long AffinityMask = (long)Proc.ProcessorAffinity;
AffinityMask &= 0x000F; // use only any of the first 4 available processors
Proc.ProcessorAffinity = (IntPtr)AffinityMask;
ProcessThread Thread = Proc.Threads[0];
AffinityMask = 0x0002; // use only the second processor, despite availability
Thread.ProcessorAffinity = (IntPtr)AffinityMask;
...
You can also use the thread's IdealProcessor
property to allow the scheduler to prefer running the thread on a specified processor (without guarantee).
Thread
最新文章
- Linux(Centos)之安装Java JDK及注意事项
- java分享第七天-03(递归打印文件目录的树状结构)
- ssh/openssh
- 算法与数据结构(2)--英雄会第三届在线编程大赛:几个bing
- jQuery Form 表单提交插件-----formSerialize,fieldSerialize,fieldValue,resetForm,clearForm,clearFields的 应用
- 【NOIP2015】提高day2解题报告
- 关于PowerDesigner
- Bzoj 3781: 小B的询问 莫队,分块,暴力
- Android事件的分发机制
- php mysql_insert_id() 获取为空
- Web Api帮助页面或用户手册
- 有关信息ACM/ICPC竞争环境GCC/G++叠插件研究记录的扩展
- java根据HashMap中的值将其元素排序
- Java的static和final关键字的用法
- OpenGL shader渲染贴图
- Qt 自定义按钮
- nginx命令启动及选项
- 设计模式-简单工厂Coding+jdk源码解析
- poj2352树状数组解决偏序问题
- C++学习二继承