Difference between revisions of "CPU"

From UNSW PCSoc Wiki
Jump to navigation Jump to search
Line 1: Line 1:
A Central Processing Unit (CPU), is a computer component that does computation for the PC.  
+
A Central Processing Unit (CPU), is a computer component that performs the bulk of computational work for the PC.  
  
Due to its role, it can be seen as the brain of the computer.
+
Due to its role, it is often described as the "brain" of a computer.
  
 
==Function==
 
==Function==
A CPU purpose is to compute things for the computer. It does this by following the set of instructions(look in architecture) detailed in a computer program.  
+
A CPU's purpose is to compute things for the computer. It does this by following the set of instructions (see the Instruction Sets section below) detailed in a computer program.  
  
In current times CPU are not just processing units but also handle other tasks. One such controller that has been moved onto the CPU is a memory controller.
+
In current times CPUs are not just processing units but also handle other tasks. One such controller that has been moved onto the CPU is a memory controller.
  
  
 
==Instruction Sets==
 
==Instruction Sets==
A CPU follows commands which it uses to compute values. This is what is known as 'the ones and zeros' which a computer is processing.
+
A CPU follows instructions which it uses to carry out arithmetic and logical operations, conditional subroutines and memory operations, amongst many others. These instructions are stored in the form of binary (1s and 0s) bytes within memory and generally consist of an opcode (the name of the instruction, such as add or store to memory) and operands (the data the instruction should be performed on, such as the number stored in a certain memory address).
All programs get compiled into these instructions which the cpu executes. Note the Operating Systems are also programs and thus are just instructions as well.  
+
 
 +
All programs get compiled into instructions which the CPU executes. Note that Operating Systems are also programs and thus are just instructions as well.  
  
 
The reason this is important is that you can only run programs that are compiled for your instruction set.
 
The reason this is important is that you can only run programs that are compiled for your instruction set.
  
The instruction set which Intel and AMD CPU use is called x86 and x86_64. You might see that on the end of some installer filenames. This is  
+
The instruction set which Intel and AMD CPU use is called x86 and x86_64 (a 64 bit extension of the original x86). Another common instruction set is ARM which is is used by most popular smartphone cpus.
  
Another common instruction set is ARM which is is used by most popular smartphone cpus.  
+
Windows RT and the surface RT is an example of an operating system which which runs on ARM. As the operating system is for ARM, it is unable to run win32 applications (.exe) programs. This is the reason why you need to care about the instruction set.
  
===Example of Instruction Sets Problems===
+
==32 Bit vs 64 Bit==
Windows RT and the surface RT is an example of an operating system which which runs on ARM. As the operating system is for ARM, it is unable to run win32 applications (.exe) programs. This is the reason why you need to care about the instruction set.
+
 
 +
You might see 32 or 64 bit specified on the end of some installer filenames. This is important as 64 bit programs cannot be run on 32 bit systems.
  
 +
Higher bit systems and programs are able to address more memory. 32 bit programs for example are restricted to 4GB of memory, whereas 64 programs can access 16 EXABYTES!!! of memory. Far more than any modern system would have.
  
 
==Architecture==
 
==Architecture==
Architecture is generally used to refer to the instruction set which a cpu will use. Instead we will address the naming scheme that is used and what this means.
+
Architecture is the implementation of a CPUs instruction set. In simple terms, it is the design of the CPU internally. Different architectures often differ in ways such as number of cores, registers, cache size and implementation etc.
  
When looking at Intel's CPU release you may here terms such as Skylake, Haswell, Coffelake. On the AMD side your may here about RYZEN, Bulldozer and Piledriver. What are these referring too? In this case, this refers to the actual design of the CPU internally. This is how we see improvement in neewer generations of CPU in instruction efficiency.
+
Architectures are often given names. When looking at Intel's CPU releases you have Skylake, Haswell and Coffeelake, amongst others. On the AMD side your may hear about Zen, Bulldozer and Piledriver. What are these referring too?
  
 
==Cores & SMT==
 
==Cores & SMT==
Most modern day CPU are multicored. Having more than one core allows the user to run multiple programs at once without having to switch context.  
+
Most modern day CPUs are multi-core. Having more than one core allows the system to run multiple tasks at once without having to switch context.
  
 
This can be better explained using an analogy.
 
This can be better explained using an analogy.
Line 37: Line 40:
  
 
==Sockets==
 
==Sockets==
A CPU must be integrate into a motherboard. The socket/package is the actual pin layout which the CPU will communicate through to the motherboard. Depending on the socket it will accept different CPUs, for example the TR4 socket will accept Threadripper 1 and Threadripper 2 CPUs.  
+
A CPU must integrate into a motherboard. The socket/package is the actual pin layout which the CPU will communicate through to the motherboard. Depending on the socket it will accept different CPUs, for example the TR4 socket will accept Threadripper 1 and Threadripper 2 CPUs.
 +
 
 +
Intel has a tendency to change sockets with every new CPU generation, requiring consumers to buy a new motherboard when they wish to upgrade their Intel CPU. AMD in comparison tends to change sockets every 3 or 4 generations, allowing consumers to upgrade to a new AMD CPU without needing to buy a new motherboard.
  
 
{{Parts}}
 
{{Parts}}

Revision as of 22:19, 1 March 2019

A Central Processing Unit (CPU), is a computer component that performs the bulk of computational work for the PC.

Due to its role, it is often described as the "brain" of a computer.

Function

A CPU's purpose is to compute things for the computer. It does this by following the set of instructions (see the Instruction Sets section below) detailed in a computer program.

In current times CPUs are not just processing units but also handle other tasks. One such controller that has been moved onto the CPU is a memory controller.


Instruction Sets

A CPU follows instructions which it uses to carry out arithmetic and logical operations, conditional subroutines and memory operations, amongst many others. These instructions are stored in the form of binary (1s and 0s) bytes within memory and generally consist of an opcode (the name of the instruction, such as add or store to memory) and operands (the data the instruction should be performed on, such as the number stored in a certain memory address).

All programs get compiled into instructions which the CPU executes. Note that Operating Systems are also programs and thus are just instructions as well.

The reason this is important is that you can only run programs that are compiled for your instruction set.

The instruction set which Intel and AMD CPU use is called x86 and x86_64 (a 64 bit extension of the original x86). Another common instruction set is ARM which is is used by most popular smartphone cpus.

Windows RT and the surface RT is an example of an operating system which which runs on ARM. As the operating system is for ARM, it is unable to run win32 applications (.exe) programs. This is the reason why you need to care about the instruction set.

32 Bit vs 64 Bit

You might see 32 or 64 bit specified on the end of some installer filenames. This is important as 64 bit programs cannot be run on 32 bit systems.

Higher bit systems and programs are able to address more memory. 32 bit programs for example are restricted to 4GB of memory, whereas 64 programs can access 16 EXABYTES!!! of memory. Far more than any modern system would have.

Architecture

Architecture is the implementation of a CPUs instruction set. In simple terms, it is the design of the CPU internally. Different architectures often differ in ways such as number of cores, registers, cache size and implementation etc.

Architectures are often given names. When looking at Intel's CPU releases you have Skylake, Haswell and Coffeelake, amongst others. On the AMD side your may hear about Zen, Bulldozer and Piledriver. What are these referring too?

Cores & SMT

Most modern day CPUs are multi-core. Having more than one core allows the system to run multiple tasks at once without having to switch context.

This can be better explained using an analogy. Imagine that a core is a worker in a factory. In this case the worker needs to do multiple tasks in the factory so they rotate around doing each task so they do not spend too much time on a single task. If we were to add more workers we would be able to do more work if their were tasks the other user could do.

SMT stands for Simultaneous Mutlithreading.

Sockets

A CPU must integrate into a motherboard. The socket/package is the actual pin layout which the CPU will communicate through to the motherboard. Depending on the socket it will accept different CPUs, for example the TR4 socket will accept Threadripper 1 and Threadripper 2 CPUs.

Intel has a tendency to change sockets with every new CPU generation, requiring consumers to buy a new motherboard when they wish to upgrade their Intel CPU. AMD in comparison tends to change sockets every 3 or 4 generations, allowing consumers to upgrade to a new AMD CPU without needing to buy a new motherboard.