Central processing unit
||This article does not have any sources. (February 2014)|
A central processing unit (CPU) is an important part of almost every computer. The CPU sends signals to control the other parts of the computer, almost like how a brain controls a body.
The CPU is an electronic machine that works on a list of things to do, called 'instructions'. It reads the list of instructions and does (executes) each one in order. A list of instructions that a CPU can read is a computer program. A machine that can perform the job of a CPU is often called a Turing machine by mathematicians.
The CPU market for desktop (home) computers is controlled by two companies: Intel and Advanced Micro Devices (usually shortened to AMD). There are other CPU manufacturers like ARM, IBM, VIA, MCST, ELVEES, SRISA, NTC Module, Sun Microsystems and others, but their CPUs usually have more specific uses (for example in game consoles or in the military).
Types of CPUs[change | change source]
There are mainly two different types of CPUs used in modern desktop systems: 32-bit CPUs and 64-bit CPUs. The instructions in a 32-bit CPU are good at handling data that is 32 bits in size (most instructions "think" in 32 bits in a 32-bit CPU). Likewise, a 64-bit CPU is good at handling data that is 64 bits in size (and is often good at handling 32-bit data too). The size of data that a CPU handles best is often called the word size of the CPU. Many older CPUs from the 70s, 80s and early 90s (and some modern small CPUs) have an 8-bit or 16-bit word size.
Registers[change | change source]
When the CPU runs a computer program, it needs somewhere to store the data that the instructions operate on (the data that they read and write). This storage is called a register, and a CPU usually has many registers. Registers must be very fast to access (to read and write). Therefore they are part of the CPU chip itself.
Memory[change | change source]
Storing all data in registers would usually make the CPU too complicated (and very expensive). Therefore, registers usually only store the data that the CPU is working on "right now". The rest of the data used by the program is stored outside the CPU in RAM (memory) in separate chips.
When the CPU wants to read or write some data in RAM, it outputs an address to that data. Each byte in RAM has an address. The size of addresses is often the same as the word size: A 32-bit CPU uses 32-bit addresses, etc. Because the size of addresses is limited, the maximum amount of memory is also limited.
A 32-bit processor can usually only handle up to 4 GB of RAM (unless extensions such as Intel's Physical Address Extension are used). This is the number of different bytes that can be selected using a 32-bit address (each bit can have two values - 0 and 1 - and 232 bytes is 4 GB). A 64-bit processor might be able to handle up to 16 EB (16 exabytes, around 16 billion GB, or 16 billion billion bytes) of RAM.
The amount of memory that a processor can handle does not only depend on the processor, but it also depends on the operating system used. For example, Windows 7 Starter Edition with a 64-bit processor can only handle up to 8 GB of memory. Compare that to Windows 7 Ultimate with a 64-bit processor which can handle up to 192 GB of memory.
Cache[change | change source]
On modern computers, RAM is much slower than registers, so accessing RAM slows down the program. To speed up memory accesses, a faster type of memory called a cache is often put between the RAM and the main parts of the CPU. The cache is usually a part of the CPU chip itself, and is much more expensive per byte than RAM.
The cache stores the same data as RAM, but is usually much smaller. Therefore all the data used by the program might not fit in the cache. The cache tries to store data that is likely to be used a lot. Examples include recently used data and data close in memory to recently used data.
Often it makes sense to have a "cache for the cache", just as it makes sense to have a cache for RAM. In multi-level caching, there are many caches, called the L1 cache, the L2 cache, and so on. The L1 cache is the fastest (and most expensive per byte) cache and is "closest" to the CPU. The L2 cache is one step away and is slower than the L1 cache, etc. The L1 cache can often be viewed as a cache for the L2 cache, etc.
Buses[change | change source]
Buses are the "wires" used by the CPU to communicate with RAM and other components in the computer. Almost all CPUs have at least a data bus - used to read and write data - and an address bus - used to output addresses.
Instruction sets[change | change source]
An instruction set (also called an ISA - Instruction Set Architecture) is a "language" understood directly by a particular CPU. These languages are also called machine code. They say how you tell the CPU to do different things, like loading data from memory into a register, or adding the values from two registers. Each instruction in an instruction set has an encoding, which is how the instruction is written as a sequence of bits.
Programs written in programming languages like C and C++ can't be run directly by the CPU. They must be translated into machine code before the CPU can run them. A compiler is a computer program that does this translation.
Machine code is just a sequence of 0s and 1s, which makes it difficult for humans to read it. To make it more readable, machine code programs are usually written in assembly language. Assembly language uses text instead of 0s and 1s: You might write "LD A,0" to load the value 0 into register A for example. A program that translates assembly language into machine code is called an assembler.
Functionality[change | change source]
Here are some of the basic things a CPU can do:
- Add one number with another
- Test to see if one number is bigger than another
- Move a number from one place to another
- Get a number from memory
- Jump to another place in the instruction list
- Execute Commands
Even very complicated programs can be made by combining many simple instructions like these. This is possible because each instruction takes a very short time to happen. Many CPUs today can do more than 1 billion (1,000,000,000) instructions in a single second. In general, the more a CPU can do in a given time, the faster it is. One way to measure a processor's speed is MIPS. Flops and CPU clock speed (usually measured in gigahertz) are also ways to measure how much work a processor can do in a certain time.
A CPU is built out of logic gates; it has no moving parts. The CPU of a computer is connected electronically to other parts of the computer, like the video card, or the BIOS. A computer program can control these peripherals by reading or writing numbers to special places in the computer's memory.
Multiple Cores[change | change source]
Some newer processors have "Multiple Cores". This means that they have many processors built on to the same chip so that they can do more than one thing at once.
While the individual cores might be slower than a single core processor, all the cores can work together to go faster. This means that the GHz might be lower, however the overall speed of the processor will be higher.
To make an analogy, think of Traffic lanes;
- One road having one lane, which takes up 50 cars in 10 minutes.
- And another road having two lanes, This will take 25 cars in the same 10 minutes and if one of the lanes has a problems cars can go to the other lane.
In today's modern computers, some processors may have up to eight cores and are available to all consumers, like the AMD FX-8350.
Manufacturers[change | change source]
The following companies make computer CPUs: