3

I'm a bit confused about the number of cores on my Mac. I'm not entirely clear on the difference between processors, cores, and threads. If I check 'About this Mac', I see 1 processor, 2 cores. But I'm working in Node.js and if I check os.cpus().length, it returns 4. Why are these numbers different? Is it just because each core has 2 threads?

cweber105
  • 535
  • 1
  • 4
  • 21
  • hyperthreading. you may have one physical core, but because of intel's marketing gurus, that one core APPEARS as two to the OS – Marc B Oct 06 '16 at 18:22
  • processor = the physical chip. core = a discrete execution unit within that chip. most intel i-series chips are either two- or four-core. then there's hyperthreading, which makes a core appears as two separate cores, so a hyperthreaded cpu effectively appears as double the cores, so your average core i7 cpu will show 8 cores, even though there's only 4 actual physical ones, inside that one chip package. – Marc B Oct 06 '16 at 18:27

2 Answers2

5

Threads are elements of software, not hardware They are not relevant here. Your Mac has two cores and has support for hyper-threading. The latter makes it appear that you have twice as many cores as you really have.

Brick
  • 3,998
  • 8
  • 27
  • 47
  • 1
    So to clarify - 1 processor (intel i5), 2 cores in that processor, each hyper-threaded, which allows the cpu to effectively function with 4 cores? So 'hyper-threading' is a hardware spec, and 'threading' is a software abstraction? – cweber105 Oct 06 '16 at 19:34
  • 1
    That's pretty much right. "Hyper-threading" is an Intel brand name for the ability to simultaneously execute multiple instructions on a single core. It's a little confusingly named since it as an aspect of hardware while threads themselves are an aspect of software. The cores can pretty much always execute threads in parallel. The hyper-threading is more or less effective depending on various hardware and software factors, so you're not necessarily really getting the 2x performance increase in practice. https://en.wikipedia.org/wiki/Hyper-threading – Brick Oct 07 '16 at 00:22
1

You have a processor with two physical cores, each one supporting Hyper-threading (Intel's brand, it means that they can run 2 threads at the same time), so you have "four logical cores".

Pablo Lozano
  • 10,122
  • 2
  • 38
  • 59