Wednesday, February 26, 2014

What is Core, Processor and CPU?

The terms 'Processor', 'Core', and 'CPU' are all poorly defined and have undergone many changes in meaning over the year as computer architectures have evolved and changed.

Under modern terminology, 'Processor' and 'CPU' mean more or less exactly the same thing. It would be more accurate to refer to the 'processor package' because there's no real standard to what a the package contains. Very old CPUs from 15-20 years ago contained little more than the bare minimum to execute tasks.











A core is usually the basic computation unit of the CPU - it can run a single program context (or multiple ones if it supports HW threads such as hyperthreading on intel CPUs), maintaining the correct program state, registers, and correct execution order, and performing the operations through ALUs. For optmization purposes, a core can also hold on-core caches with copies of frequently used memory chunks.

A CPU may have one or more cores to perform tasks at a given time. These tasks are usually software processes and threads that the OS schedules. Note that the OS may have many threads to run, but the CPU can only run at a given time X such tasks, where X = number cores * number of HW-threads per core. The rest would have to wait for the OS to schedule them whether by preempting currently running tasks or any other means.

In addition to the one or many cores, the CPU will include some interconnect that connects the cores to the outside world, and usually also a large "last-level" shared cache. There are multiple other key elements required to make a CPU work, but their exact locations may differ according to design. You'll need a memory controller to talk to the memory, IO controllers (display, PCIe, USB, etc..). In the past these elements were outside the CPU, in the complementary "chipset", but most modern design have integrated them into the CPU.

In addition the CPU may have an integrated GPU, and pretty much everything else the designer wanted to keep close for performance, power and manufacturing considerations. CPU design is mostly trending in to what's called "SOC" - system on chip.

They contained the ALUs, fetch and decode hardware, Instruction pipeline, Interrupt handling hardware, some IO control hardware and that's about it. After this, cache memory was added to the CPU to improve execution

Then, the execution parts of the processor were duplicated. The ALUs, fetch and decode, instruction pipline, and some cache memory were organized into what we now call "cores". Each core is capable of functioning on its own and contain all the resources necessary to perform computational tasks that do not involve interacting with components outside the CPU. IO Control, interrupt handling, etc... were all shared between all the cores.

More recently the memory controller itself has been moved into the CPU package. It sits along side the CPU cores but it is not part of them. Thus it is part of the package, or part of the processor/CPU but it is not part of the 'cores'. Intel used to specifically refer to this as the 'un-core'.

This gets even more complicated when we talk about systems which have multiple physical processor packages installed. Many server and workstation platforms can have 2, 4, or even more processor packages installed. Each processor package contains the same hardware.

Thus, the number of 'cores' in a machine can be computed by taking the number of cores per package and multiplying it by the number of packages in the system. A computer which has two quad core processors has the same number of cores as a computer which has a single octal core processor.


In simpler terms,

Core: Cores are what handle the arbitrary mathematical and logical workloads. They take high level machine instructions (x86, ARM, MIPS, etc...) and 'decode' them into physical circuit operations. Many other parts of the system, such as GPUs and chipsets operate in a similar manner but are designed with specific purposes in mind which makes them more efficient at these particular tasks. CPU cores are designed with a general purpose, making them jacks of all trades.

Processor / CPU: The combination of one or more 'cores' with supporting hardware and shared resources.

Processor package: The physical casing in which one or more processors or CPUs is contained. The pinout from the package is what allows the processor to interface with the rest of the system. Some processor packages may contain more than one processor die inside of them, or may have the cores and shared resources on separate pieces. The contents of the processor package and how it is organized are up to the manufacturer, hence the distinction between Processor and Processor Package.

For example, the Core 2 Quad processors were actually two individual Core 2 Duo processors in the same package with some very simple supporting hardware to allow them to work together. This stands in contrast to the more modern Sandybridge processors which have all 4 cores and supporting hardware on one chip, a far more efficient design.

No comments:

Post a Comment