How do computers work? Part 2: Hardware Basics

I know this is kind of counterintuitive that I am skipping from Binary to Computer Hardware, without giving much of an insight into binary, but that would be boring if I did that and I’m not writing a textbook for God’s sake. Instead, I want you to understand computers. So, let’s get into the some basic hardware.

The fundamentals of computers: Arithmetic, Logic, Control Flow and IO

Arithmetic

Simple calculations such as addition, subtraction, multiplication, division etc. are part of arithmetic. Arithmetic is one of the fundamental tasks for computers to perform. We won’t call a machine a computer if it can’t do arithmetic.

Logic

By logic, I mean the ability for a computer to make decisions. Such as comparing two numbers, testing for equality, binary logic etc. are part of the logic we’re talking about. If a computer can’t do that, it’s pretty much useless for us. Many a times, simple logic and control flow together, builds more powerful logic.

Control Flow

Control flow is the ability for a computer to execute arbitrarily. For example, there are five statements in a program,

  1. Take two numbers a and b from user
  2. if a > b then GO TO line 4
  3. otherwise GO TO line 5
  4. Display a and exit.
  5. Display b and exit.

Now, let’s look at the statements, in the first line we take two numbers from the user, in the second line we have to make a decision if a > b, now due to logic, our computer can indeed tell that, but it asks the computer to skip line 3. And that is control flow, it is the ability for a computer to execute arbitrarily. If a computer can’t do that, it is pretty useless. And also, exiting in line 4, without control flow that would be impossible as well.

Input and Output

Input and Output is the ability for a computer to interact with the outside world. As you are reading this web page. The computer doesn’t “see” things that way, thanks to IO, the computer can show you the web page that you understand. Right click and view source, see if you still find it comfortable.

While you may consider I have deviated from my word of promising simple and practical ways into computer, I think it’s pretty necessary to have this information. Some of our readers may know nothing about these and this might be informative. Which is the only thing that matters to me. As I run no banner ads, so, my only reward is viewership, interaction and feedback.

The Basic Block diagram of a computer. Illustration by me

The Basic Structure of computers

If you studied a bit of computers, you know this diagram. It’s probably one of the most important structures of the computer. It’s beautiful, it has the entire blueprint of a Von Neumann computer yet it’s extremely simple to follow and understand.

Some Common IO Devices. Source: Information Technology PK

1. I/O i.e. Input/Output of Computers

I/O gives a computer the ability to interact with the outside world. If you’ve worked on a computer, you’ve seen a monitor, keyboard/mouse or a touch screen, maybe you’ve seen a scanner or printer, maybe you’ve added a USB drive or SD Card. They all are part of I/O.

Much of a computer is IO. If a normal regular user can use it, it’s pretty much an IO. Basically, IO allows a computer to connect to outside devices. These outside devices deal with humans (or other robots, computers, animals, sensors or anything under the sun), and feed the computer with information.

storage devices.
Various Storage devices over history

2. Memory (RAM, HDD, SSD etc) of Computers

We all need memory, right? We need more RAM, More Hard Drive Space, a larger SD Card, a bigger SSD, and a huge cloud storage! These all are part of the memory unit. You understand now that memory help a computer store information. Either temporarily (RAM) or permanently (ROM/HDD/SSD etc).

Storage technology has come a huge way. Back in the ’90s we had whopping RAM of 64MB – 256MB. Hard Disks of a few gigabytes (30-40GB) were tremendous!

Fast forward two decades and we have 16-32GB of RAM, 1-2TB of HDD and 200-500GB of SSD, and we even have NVME SSDs and now Intel Optane! The developments remind us how important storage is!

Computer Storage is of two types.

  1. Primary Memory: This memory is the fundamental part of a computer, without primary memory, a computer will stop functioning properly.This is mostly RAM (Random Access Memory) and ROM (Read Only Memory). When the computer boots up, the ROM has a small program, which loads the operating system from the hard drive and transfers it to the RAM. And the RAM is super useful, the CPU takes instructions and data from the RAM, it also stores any intermediate or temporary value in the RAM! As of now, you’re on a web page, and RAM holds much of what you’re reading!
  2. Secondary Memory: This is the storage that a computer can, in theory, live without. But we all know what happens if you remove the hard drive out of your computer, it’s pretty much useless. Secondary memory is slow(er than primary) but can store a huge amount of data.
Types of Storage

So far, we have 2 major types of storage:

  1. Volatile storage: This type of storage needs power to maintain their state. If you switch it off, it’s gone. Clean. Wiped! All RAMs make it to this list. They are fast!
  2. Non volatile storage: This type of storage needs no power to maintain its state. So, you can make some changes, turn off your computer, and when you turn it back on, the information still stays on your computer. HDD, SSDs, CD/DVD/Blu-Ray, nVME SSD make it to this list! They are slow(er)

One recent technology that is showing promise is Intel’s Optane, it can serve as an intermediary cache between Secondary storage and RAM! It can be several magnitudes faster than SSDs, while still being able to store large amount of data. The end goal is to have non-volatile storage only, programs and files all staying together, with ultra fast access speeds! No boot time, but there will be challenges! If your computer freezes, a reboot won’t help! Dedicated hardware will have to be present for a reboot like scenario (which will lead to data loss like unsaved files)

Central Processing Units
Various CPU

3. The Central Processing Unit of Computers

This part houses the Control Unit and the Arithmetic & Logic Unit (ALU). The Control Unit provides Control signals which enables a computer to work seamlessly (it’s like traffic lights, it keeps the data flow consistent and crash free). The Arithmetic & Logic Unit on the other hand performs calculations and logic.

Control Unit

The CU tells the computer’s memory, arithmetic/logic unit and input and output devices on how to respond to a program’s instructions. And it also provides the computer with timing and control signals.

The CU is the first circuit that receives external instructions or data through the bus (more on this later) and decodes the instruction/data and directs it to the right device (CPU/GPU or other circuits such as sound card etc). It also manages execution and a lot of things. If you ask the cpu to do 2+3, it will receive 2, 3 and add. And then it will store the 2 and 3 into proper registers and instruct the ALU to perform addition. And when it completes, it will direct them back into the specified memory location.

Arithmetic and Logic Unit (ALU)

The Arithmetic and Logic Unit performs many of the most important tasks on a computer. Like arithmetic operations such as addition, subtraction, multiplication, division (and other architecture specific operations), bitwise logical operations (AND, OR, XOR, One’s complement), and bit shift operations (Arithmetic Shifts, Logical Shift, Rotate (through carry)

For now, I won’t go deep into them. But its pretty important! Without it, you wouldn’t be able to read this text, because every pixel has it’s value calculated according to the font which takes some help from the ALU!

Computer components
How various components work together?

How things work together?

I understand, you need a recap, or at the very least a TL;DR version.

There are three parts of the computer, IO, Memory and CPU. IO handles inputs and outputs (like io devices, peripherals etc), The Memory section handles the storage department and the CPU can process.

Like your mouse provides input to the computer, and your computer receives it through IO, then that is stored temporarily in memory, and the display is updated, updating the location of the cursor. Regardless to say, your mouse provides only the relative change in its values, the computer first looks at the position of the cursor, applies a whole bunch of calculations (like adjusting to the set sensitivity) and updates the location! All these, just to update the position of the cursor on a computer!

Touch Screens need even more computation. Though touch screens which are overlaid on the display return absolute coordinates, but the computer still has to do a whole bunch of calculations to identify the gestures, long press etc.

This is a very basic article on hardware! More interesting and fun stories will be covered! Stay tuned!

Just in case I need to reiterate! There are no ads on this blog! And never will be one. I just want to share my knowledge and experiences with you! It gives me kick!! So, if you liked this post, consider sharing, and tap the bell icon below and you’ll receive notifications!

Recommended Readings:

How do computers work? : http://www.explainthatstuff.com/howcomputerswork.html

RAM: https://en.wikipedia.org/wiki/Random-access_memory

BIOS: https://en.wikipedia.org/wiki/BIOS

ALU: https://en.wikipedia.org/wiki/Arithmetic_logic_unit

CU: https://en.wikipedia.org/wiki/Control_unit

Recent Posts

Recent Comments

Archives

Categories

Meta

Be First to Comment

    Share your valuable feedback