是否可以在OS X中设置pthread CPU关联性? [英] Is it possible to set pthread CPU affinity in OS X?

查看:85
本文介绍了是否可以在OS X中设置pthread CPU关联性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Linux 中,在 sched.h 中定义了 sched_setaffinity()函数,但是我似乎找不到类似的东西 Mac OS X 10.6 pthreads 实现中...如果无法设置亲和力, OS X 中的默认策略是什么?

In Linux there is a sched_setaffinity() function defined in sched.h, but I can't seem to find anything like that in Mac OS X 10.6 pthreads implementation... If it is not possible to set affinity, what is the default policy in OS X?

推荐答案

Mac OS X具有

Mac OS X has Thread Affinity API and you can use it with pthread ID as thread_policy_set(pthread_mach_thread_np(pthreadId), but, as far as I know, there are no APIs like sched_setaffinity.

这篇关于是否可以在OS X中设置pthread CPU关联性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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