如何在Linux中的C语言中获取当前进程的处理器ID? [英] how can I get the processor ID of the current process in C in Linux?

查看:713
本文介绍了如何在Linux中的C语言中获取当前进程的处理器ID?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在编写一个程序,该程序需要知道它在哪个逻辑处理器上运行.

I'm writing a program that needs to know what logical processor it's running on.

此问题告诉我如何进行汇编,而这个问题告诉我如何在汇编中使用此代码而不将其翻译为AT& T语法.

This question tells me how to do it in assembly, while this question tells me how to use this code in assembly without translating it to AT&T syntax.

是否有使用现有的Linux系统调用或库函数来实现此目的的简便方法,还是我有必要重新发明轮子?

Is there an easier way to do this using existing Linux system calls or library functions, or is it necessary for me to reinvent the wheel?

推荐答案

有特定于linux的

There's the linux specific getcpu call.

这篇关于如何在Linux中的C语言中获取当前进程的处理器ID?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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