I am writing a program in C on windows that should run as many threads as there are available kernels. But I do not know how to get the number of cores. Any ideas?
You can call GetSystemInfothe WinAPI function; it returns a structure SYSTEM_INFOthat has the number of processors (the number of cores in a system with multiple cores).
GetSystemInfo
SYSTEM_INFO
You can read the environment variable NUMBER_OF_PROCESSORS.
, .NET C, :
"cmd" Windows "cmd.exe". :
WMIC CPU Get /Format:List
"NumberOfCores" "NumberOfLogicalProcessors". , . , :
NumberOfLogicalProcessors = NumberOfCores * .
, , .
.
Source: https://habr.com/ru/post/1740708/More articles:"date_part (" era ", now () in the time zone" UTC ")" is not at the same time as "now () in the time zone" UTC "in postgresql - timezoneHow to create a web service with rails? - ruby-on-railsFinding the effect of fading and blurring simultaneously with jQuery or Javascript - javascriptLibrary for writing odf file from program C - cполучение пользовательского ввода в С# - c#uniprocessor or multiprocessor - unixProblem with mouse move event - c #Many questions about file input / output (reading / writing message lines) - cUsing open source libraries in companies with a high level of management and risk (banks, finance, etc.) - architecturehttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1740713/r-ggplot2-how-to-add-a-number-of-layers-to-a-plot-at-once-to-reduce-code&usg=ALkJrhi74kVg8djrQPaf0uIKborRAPFqWgAll Articles