Discover number of CPU cores using threads
问题 I have an assignment in which i have to write a program in C on Linux(i use CentOS), which uses threads/processes to determine the number of cores from the CPU. Firstly I tried to print the current time in mili/microseconds, because I know that there can run 1thread/core(or 2 with HT). But by miliseconds more than 10 threads printed the same amount of time and by microseconds none were identical. Secondly I tried to measure the execution time of threads with clock, given I have 4 cores, the