I Don’t Get I.T.: What is a CPU?

During my BSIT studies, I realized I was force-feeding myself loads of information to get through the courses and keep my 3.8 GPA.  As a result, my understanding of basic I.T. concepts went out of the window.  I could regurgitate plenty of information, but I couldn’t tell you the root of HOW or WHY.  So, I decided to blog about I.T. Basics.  My aim is to offer elementary-level backbone information a fourth-grader can understand, so anyone can build their tech knowledge.

Any questions, comments, concerns — feel free to comment.  I also take kindly to constructive criticism and if you have an I.T. question, ask away and perhaps you’ll see a future post about it!


 

 

What is a CPU?

The CPU is the Central Processing Unit of your computer.  The CPU carries out - or processes - all of the instructions your computer is told to do ranging from stored program instructions to actions you tell the computer to take.  Your phone, tab, XBOX... they all have one.  It isn't THE computer, it is just the brain OF the computer.  It is a very small chip that sits on the motherboard (the main circuit board of the computer).  It is NOT the memory - that is a totally separate blog post- and it is NOT your graphics card.  The CPU gets instruction and then shoots that information to where it needs to go to make it happen.

AMD CPU on Motherboard

If we are talking about huge machines, the CPU will more than likely have multiple printed circuit boards, but your home computer will have one chip called a microprocessor.  It's quite small, square square, and fits into the CPU socket of the motherboard, pins down.

CPU Diagram. ALU & CU on top; middle is memory unit; bottom is ROM, RAM, and CACHE. Storage goes to and fro RAM. Input goes into the CPU and output leaves the CPU.

What's in a CPU?

Your CPU is composed of billions of transistors on a chip, performing calculations and logical operations.  The CPU is made up of two primary parts:

  • The Control Unit (CU): The CU gets the instructions first.  It executes instructions & sends signals to the wires that connect the CPU to the rest of the computer.  There are two types of CUs - hardwired (requires physical changes to alter the work & is faster) and microprogrammable (reprogramming will alter its work & has more flexibility).
  • The Arithmetic/Logical Unit (ALU): The name is a giveaway - it does all the calculations and logical flow using logic gates.  Logic gates are Boolean switches, if you will, meaning they accept yes, no/ 1, 0 to make decisions.  Logic gates are the resistors/transistors/diodes - they accept two inputs and provide one output.  In the spirit of keeping this simple, I'll offer you a link, here, if you want to get more in-depth.  Hopefully, I can create an entirely separate post for logic gates, eventually.

Where does the CPU get the instructions to execute?

Well, when you hit the power button on your device, the CPU has to execute instructions given to it to power everything on.  Where the heck is that coming from if a CPU isn't a storage device?  Answer: registers and memory.

L10610653_03_pcb_front.jpg
  • Register (also see RAM below): a small place where data is stored.  Registers are latches - latches (aka: flip-flops) are logic gates which, again, has two inputs and one output.  They can store 1 bit of information (for reference = 1 bit equals 1 character, such as a.  8 bits = 1 byte).  These will store the CPU output data, instructions, etc.
  • Memory (RAM - Random Access Memory) (also see Register above): RAM is a collection of registers!  RAM is not permanent memory - it can be erased quickly & easily such as when you shut off your device.
  • Cache: Technically, the instructions don't come from the cache, but the cache does hold data that the CPU is going to use often and quickly.  This makes the processing time faster.
  • ROM (Read Only Memory): The ROM is non-volatile and can only be modified with some serious effort - most average users will never alter their ROM and even if the power goes out, the ROM will remain unchanged.  However, the ROM holds many instructions the CPU has to execute, such as booting the computer and loading the operating system (Windows 10, for example).

What instructions can the CPU perform?

  • Halt - Notification that a program has ended
  • Data - move, input, load, output, store
  • Control Flow - goto, call, return, if...goto
  • Arithmetic - add, subtract
  • Logic - not, or, and

A CPU's instructions are given by assembly language, compilers, and high-level languages.  The CU gets the control flow instructions and the ALU gets the arithmetic and logic, for example.  A group of computer instructions is an instruction set!  In the past, computers could only perform one instruction per clock cycle, but present day computers can perform multiple.

What is a CPU clock cycle?

How fast your computer can run depends on its clock cycle which is the amount of time between two pulses of an oscillator.  How fast is that?  Just understand that the more pulses per second, the faster your processor will be able to execute instructions.  A clock cycle is measured in Gigahertz (gHz) where 1gHz equals 10 ⁹ Hz (hertz).  A hertz is one second.  So, by that logic, gHz = 10 ⁹ Hz cycles per second!

clock-cycle.jpg

Obviously, the faster the clock, the more instructions your CPU can execute in a given amount of time.  If you want to improve your CPUs time, increase the clock rate or decrease the number of cycles - this can cause overheating, so proceed with caution.  This will be discussed in my next post - Overclocking Your CPU.

Okay, we know what the CPU does and we know where the instructions are stored, BUT how does the CPU execute the instruction?

The instructions hang out in RAM in order.  It'll have OP (operational) code and the address of the memory/register.  The CU has two registers that control the code/instructions:

  • The Instruction Register (IR): responsible for loading the OP code
  • The Instruction Address Register (IAR): responsible for loading the address of the instruction that is currently in execution

All the information being sent between the CPU/registers/memory/device are transferred by bus lines (the electrical data roadways or wires)- think of bus lines like an actual city bus line.  The bus lines are how bits of information travel from the CPU to the other computer components.  The bus size tells how many bits can be moved at one time, which is usually the same as or a multiple of the CPU word size.  The word size is easy to figure out - if your CPU says 32bit/64bit, there is your word size!

The CPU can also prefetch instructions - this cuts down on fetch time from the RAM.  Once an instruction is carried out, the next instruction is already cached in the meantime!  This aides in the instruction pipelining- when an instruction is being decoded, another is being fetched for cache, while yet another is being executed.  A pipeline.  It gets more complicated when instructions depend on each other, but this is a basic explanation of the instruction pipeline.

RetiredCPUs.jpg

How do I know if my CPU is good?

Folks will argue this question into the ground.  A quick google tells you a few things to look for:

  • The cores & threads:  most CPUs now have multi-cores (dual to eighteen, so far).  More cores (the parts of the CPU that actually get instruction and execute) means less work for each.  Don't go overboard, though, or you'll pay a pretty penny for multiple unused cores.  You must also consider threads.  Threads can be thought of like forum threads - sequences of different conversations, or in this case, sequences of instructions.  If a CPU is hyperthreading, it can work on multiple processes at a time!  Basically doubling processing time.
  • Cache: This is the temporary storage of your computer, as we spoke about earlier.  The more temp storage, the faster processing time.
  • Your motherboard: If you're buying a laptop off the shelf, find out about its CPU to choose (obviously), but if you're aiming to get your own, make sure the freaking sockets are compatible, yall!  If the motherboard and the CPU don't like each other, you're screwed anyway.
  • Frequency and thermal design:  As we said earlier, the Hz we spoke about earlier tells you the speed in which your CPU will operate.  In the past, this is all you needed to check, but now you also need to pay attention to the "instructions per clock" and the thermal design, which tells you how much heat that thing is going to produce.  This will determine the cooling you'll need - the faster the processor, the more heat, the better the cooling device you'll need!

In all honesty, an average user who just surfs Facebook and Amazon or dumps their phone photos onto their computer won't need to get detailed.  The guy at Best Buy can probably find you something that will work.  But if you work from home, all of this is important to consider - OR just message an I.T. geek to help.

For Fun: What is a CPU made of, materials-wise?

Check out this awesome YouTube video explaining it - not sponsored, not my video, just a good clip I came across!

FYI:

Computers have gotten smaller and smaller because super smart folk have figured out how to make the inner-workings smaller and smaller to include your CPU.  This is usually where a quick recap on Moore's Law comes into play.

Moore's Law states that the number of transistors in a dense, integrated circuit doubles every two years.  Named after Gordon Moore (co-founder of Fairchild Semiconductor and CEO of Intel).  This two-year prediction was right on the money for many years - decades, even.  This law has set the stage for future plans and targets for many companies.  In 2015, Gordon Moore predicted the law of his name would die, soon.  The conversation has since turned to hyperscaling.  If you think about it, physics itself won't allow Moore's Law to carry out much longer.  Read more about the death of Moore's Law here while we get back to business.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.