I do not know much about computer architecture, but some Intel processors have hyper-threading technology, which can apparently improve parallelization for applications that take advantage of it. In a processor with hyper-threading technology, the number of threads is usually twice the number of cores -- whereas in a processor without hyper-threading, the number of threads is equal to the number of cores.

My old (2007) desktop computer has an old Intel Core2 processor with 2 cores that does not support hyper-threading. So the processor has 2 threads and 2 cores. If I execute $ProcessorCount in Mathematica, it gives the output 2. However, some new processors (i.e., Intel i7 series) support hyper-threading. For example, Intel's website says that the i7-4790 has 8 threads and 4 cores. If I were to execute$ProcessorCount on such a system, would the output be 4 or 8?

• I have an Intel® Core™ i7-4790K CPU @ 4.00GHz × 8 and $ProcessorCount gives 4! :( – Mahdi May 25 '15 at 22:04 • Of course. MMA does not "know" what's happening under the covers, the O/S scheduler handles that... – ciao May 25 '15 at 22:09 • @ciao, well, it can get the information about how many physical cores are there if it needs to (at least under Linux-based OSes ... ) – Bichoy May 25 '15 at 23:26 • Great question. Like @Mahdi, my Intel® Core™ i7-3820QM CPU has 2x hyper-threading, but$ProcessorCount gives 4, the number of physical processors. – bbgodfrey May 26 '15 at 1:10
• Probable dupe of this. Simply put by Yes, default on v9 but only if you force it to on v10, and its impact is variable dependent on the calculation. So the simple answer is try it and see if it works for your use case. – Gordon Coale May 26 '15 at 8:44

In Mathematica 10 or newer, as pointed out by Szabolcs, $ProcessorCount will return the number of physical CPU cores, not the number of logical cores. Thus, on a system with 4 cores and 8 threads, In[1]:=$ProcessorCount

Out[1]= 4

Functionality which uses multiple kernels in parallel, for example ParallelEvaluate and friends, will then launch only 4 subkernels by default. This can be overriden by specifying an explicit number of kernels to start, say LaunchKernels[8].

Mathematica also uses other kinds of parallelism, where multiple threads are running in parallel within the same kernel or library. The number of kernel threads, used e.g. by Compile and many image processing functions can also be changed and is controlled by

Out[3]= {ParallelOptions -> {ParallelThreadNumber -> 4}}

Similarly, the maximum number of threads used by the Intel MKL library (for instance, when performing machine precision linear algebra computations) is