Main content
Computers and the Internet
Course: Computers and the Internet > Unit 2
Lesson 4: Computer componentsCentral Processing Unit (CPU)
The CPU is the brain of a computer, containing all the circuitry needed to process input, store data, and output results.
The CPU is constantly following instructions of computer programs that tell it which data to process and how to process it. Without a CPU, we could not run programs on a computer.
For example, a simple calculator program might instruct the CPU to take two numbers, 2 and 2, add them, and send back the result.
The CPU can process those instructions easily, thanks to a control unit that knows how to interpret program instructions and an Arithmetic Logic Unit (ALU) that knows how to add numbers. With the control unit and ALU combined, the CPU can process much more complex programs than a simple calculator.
Inside the CPU
At the hardware level, a CPU is an integrated circuit, also known as a chip. An integrated circuit "integrates" millions or billions of tiny electrical parts, arranging them into circuits and fitting them all into a compact box.
We can visualize the layers of the CPU chip:
Some of those layers are physical devices, like the chip and transistors, and some of those layers are abstractions, like logic circuits and gates.
It's impressive that we can put together seemingly simple devices like logic gates to create CPUs that power complex devices like our phones, computers, and even self-driving cars.
🙋🏽🙋🏻♀️🙋🏿♂️Do you have any questions about this topic? We'd love to answer— just ask in the questions area below!
Want to join the conversation?
- what are the differences between GPU and CPU?(6 votes)
- The GPU or Graphics Processing Unit is specialized to crunch numbers efficiently to output smooth graphics from something like a video game. The CPU can basically do anything but since the architecture of the GPU is more efficient for rendering graphics it hands the workload to the GPU. Both are types of microprocessers that handle different tasks. The GPU is generally divided up into many cores whereas the CPU is only split into a few cores. GPUs are also used for mining cryptocurrencies since they can crunch numbers so quickly. Hope this helps.(17 votes)
- Can the CPU actually store data? My very generic google surch tells me it stores only the data necessary forr the current operation, but that seems awfully close to the description of the RAM-Memory in the following class. So the CPU only processes it and stores it in RAM-Memory or does the CPU store the data too?(5 votes)
- Yes, CPUs can store very small amounts of data, called cache. Usually only 25-100mb of data though.(5 votes)
- Hey guys,
I'm really curios to know how the control unit - which knows how to interpret program instructions - and the Arithmetic Logic Unit (ALU), which knows how to add the numbers in this lessons diagram, work?
Like how does the circuitry in the CPU know how to execute these instructions?
Thanks!(1 vote)- The whole thing works by using logic gates.
The video "How Computers Calculate - the ALU" on youtube produced by the PBS explains the whole thing really well, as it's to complex to explain it via forum post.(7 votes)
- What is the special memory used only by the CPU?
Where is it located?
What are the different types of this special memory?(3 votes)What is the special memory used only by the CPU?
A: Registers (collectively referred to as L1 Cache)Where is it located?
A: On the chip, next to the ALUWhat are the different types of this special memory?
A: Types of registers included will vary by processor, but usually some combination of
- Acumulator (ACC): stores data for all ALU operations
- Program Counter (PC): stores address of next instruction
- Instruction Register (IR): stores instruction
- Data Register (DR): stores data
- Address Register (AR): hold addresses to primary memory
- Temporary Register (TR): stores temporary data
- I/O Register (INTR / OUTR): stores input and output data
Sets of registers work together to facilitate the most basic units of computation that take place in a computer. The size of a register can be 8, 16, 32, or 64 bits. The registers in a 32 bit computer are 32 bits wide, for example.
Each CPU (logical core) gets its own set of registers. The term "Virtual Cores" or "Threads" stems from the idea of including multiple (independent) sets of registers for each physical CPU (core). eg; "8 cores 16 threads" == 8 CPUs and 16 sets of registers (2 per core).
You can use tools like GDB to inspect and manipulate the registers while a program is running. This can be useful for debugging or exploiting computer software.(3 votes)
- The C.P.U takes in binary numbers which are placed in 1s and 0s. How does the computer take it in as what we called binary number system? does it change it or it is represented in binary inside the computer?(1 vote)
- The computer takes in currents of electricity, 1 and 0 are already an abstraction. In the CPU transistors are manipulated to make the CPU do what it does.
There should be more about that in the following sections or you can search "PBS Crash Course Computer Science #1" produced by the PBS which goes a little bit more into depth.(4 votes)
- Does logical processors or physical processors decides if a cpu is a dual, quad or octa core processor?(2 votes)
- Given that a "Logical processor" or a "logical core" is the number of threads/core * how many physical cores you have, having a 'Intel i7 1135-H', which has '4 cores' * '8 threads', would give you 32 "logical cores"*. By a 4 core processor, we refer to number of *physical cores!(1 vote)
- so if i had a cpu how much would i buy it for(2 votes)
- Why is CPU called the brain of the computer?(2 votes)
- If you think about what a computer really is, you realized that there's essentially 2 jobs that all computer systems must accomplish:
1. Direct the processing of information (take input from a keyboard, combine it with values from a hard drive, and then spew it out into a printer or graphics card)
2. Physically preform the processing (ex: move data, combine pieces of information/data together logically, arithmetically add pieces of data together etc.)
You can think of the CPU as a "brain", because it controls how data flows throughout the entire computer system , under the influence of instructions, which are called "programs"!
In this analogy, you can think of "software" as your personality, or just "you" psychologically speaking. The electrons, transistors, digital logic gates, and instruction set architecture are your blood, bones, tissues, and organs respectively.
The CPU(your brain) dictates how these organs function together as a system("ex: as your body"), while also regulating each individual subsystem using code as hormones!(1 vote)
- For the "simple calculator program," why are the input numbers (in binary) 2, 2, and 5, and the output is 4? Does the 5 somehow represent the "plus" action?(1 vote)
- The article doesn't explicitly state it, but the 0101 is likely used to represent the addition instruction. These bits would be sent to the Arithmetic Logic Unit (ALU) and would signal to the ALU that it needs to perform addition using the two inputs (0010 & 0010).
There are actually quite a few bits that go into an instruction. Extra bits are used to signify the location where we will store the result of the operation (in a register, in memory, etc.) and whether or not a jump will be performed (i.e. jump to program instruction xxx if xxx evaluates to true).
In this instance, I'm not certain what the 0101 was specifically meant to represent, but regardless its presence is important to signify that the CPU's input will consist of more than the operands.(2 votes)
- why are transistors so important(1 vote)