如何获得在Win32中的内核数量? [英] How to get number of cores in Win32?

查看:138
本文介绍了如何获得在Win32中的内核数量?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在写一篇窗口在C程序需要运行多个线程可用内核。但我不知道如何让内核的数量。任何想法?

I'm writing a program in C on windows that needs to run as many threads as available cores. But I dont know how to get the number of cores. Any ideas?

推荐答案

您可以致电<一个href=\"http://msdn.microsoft.com/en-us/library/ms724381%28VS.85%29.aspx\"><$c$c>GetSystemInfo WinAPI的功能;它返回一个 SYSTEM_INFO 结构,其具有处理器的数量(其是核心的多芯CPU的系统上的数字)。

You can call the GetSystemInfo WinAPI function; it returns a SYSTEM_INFO struct, which has the number of processors (which is the number of cores on a system with multiple core CPUs).

这篇关于如何获得在Win32中的内核数量?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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