# CPU Architecture fundamental

### Terminology

* `Processor`: the **physical chip** that plugs into a socket on the system or processor board and contains one or more CPUs **implemented as cores or hardware threads**.
* `Core`: an independent **CPU instance** on a multicore processor. The use of cores is a way to scale processors, called chip-level multiprocessing (CMP).
* `Hardware thread`: a CPU architecture that supports executing **multiple threads in parallel on a single core** (including Intel’s Hyper-Threading Technology), where each thread is an independent CPU instance. One name for this scaling approach is **multithreading**.
* `CPU instruction`: a single CPU operation, from its **instruction set**. There are instructions for arithmetic operations, memory I/O, and control logic.
* `Logical CPU`: also called a virtual processor (vCPU), an operating system CPU instance (a schedulable CPU entity). This may be implemented by the processor as a hardware thread (in which case it may also be called a virtual core), a core, or a single-core processor.
* `Scheduler`: the kernel subsystem that **assigns threads** to run on CPUs.
* `Run queue`: a queue of runnable threads that are **waiting to be serviced** by CPUs. For Solaris, it is often called a dispatcher queue.

### Example

Intel® Core™ [i7-5557U](https://ark.intel.com/products/84993/Intel-Core-i7-5557U-Processor-4M-Cache-up-to-3_40-GHz) Processor on Macbook pro: 2 cores, 4 threads

```
sysctl -n hw.ncpu # = 4
sysctl -n hw.physicalcpu # = 2
sysctl -n hw.logicalcpu # = 4
```

### Reference

Chapter 6: CPUs in <http://www.brendangregg.com/sysperfbook.html>
