Computer Architecture Basics, Made Clear in 3 Parts

Computer Architecture Basics: Learn everything you need to know about CPU, processes, RAM and permanent storage

Share This Post

If you want to learn computer architecture basics in a few minutes, you came to the right place. In this guide, we show all the basics that you need to understand computers and their architecture. The goal of this computer architecture guide is to give you the tools you need to understand more complex guides and topics in computing.

An Introduction to Computer Architecture Basics

What is a Computer?

We all know what a computer is intuitively, but let’s give a more formal definition.

A computer is a machine that solves human problems, mainly dealing with information.

As a human, we have many problems that we want solved: we want to call our aunt, we want to see a movie, we want to produce the best sales forecast for the next quarter, we want to calculate the trajectory to put a satellite into space, and more. A computer is a machine designed to solve our problems.

It mainly deals with information because its main activity is processing information and data, rather than executing something physical. A computer can control something physical, such as a robotic arm or a car, but it does so by processing information (i.e., telling the arm what to do).

We can clearly see that laptops, smartphones, tablets, and even smart-home equipment can fall in this category. In fact, the world is full of computers nowadays, and some are very small. The most common computers out there are general purpose.

A general-purpose computer is a type of computer that can do virtually anything, but it is also not specialized in anything particular. What it can do is defined by code, software, that we will see later. On the other hand, a special-purpose computer can do only a limited set of tasks, and can do them very fast. This is because it has been designed to do some activities in hardware, which is faster than software. However, this means it is physically limited to do only a small set of tasks. An example of special-purpose computer can be a router, specifically designed to forward communication to the Internet.

Hardware vs Software

If you want to know computer architecture basics, we need to start with hardware and software. In fact, each computer, each system has two types of components: hardware and software.

  • Hardware is the part of the system that you can touch, it is all the physical components
  • Software is the abstract part of the system, is the code running inside the computer and defining the functionality

Think of a system like a delivery truck: the hardware is the truck itself, while the software is the driver. All the power that moves around your parcel comes from the truck (the hardware), but this hardware will sit doing nothing if there is no driver (software) to direct it on where to go and what to do. The same is true in computer architecture basics.

Operating Systems

Computers will have operating systems. You may be familiar already with Windows, Linux, or macOS, the most common operating systems for desktops and laptops. However, also Android and iOS for smartphones are operating systems.

The operating system is a software that acts as a container for all the other software in the computer. In fact, the operating system is nothing but a resource manager.

A computer architecture has some basic components in hardware, that we will see in a second. Just like the driver needs to use the truck to deliver parcels, our software needs to use hardware components to solve problems. The problem is, there are always competing problems and software: multiple apps wanting to do different things. The operating system has to cast some order in all of this, deciding which app gets to do what and when.

The operating system allocates hardware resources to other software according to various criteria. It is its key role as part of computer architecture basics.

Computer Architecture Basics Components

Overview of Computer Architecture Basics Components

In computer architecture basics, each system or computer has some common components. We can list them quickly here, and then see them in more details.

  • CPU executes programs
  • Memory stores data and programs that are in execution
  • Permanent Storage stores data and programs that are not in execution and that are to be kept indefinitely
  • Devices, such as keyboards, screens, printers, Bluetooth dongles and more: they allow interaction with the external world
Computer Architecture Basics Components
The components of a basic computer architecture are: CPU, RAM, and Permanent Storage.

This is, of course, an oversimplification that only lists the main components. In reality, a computer architecture will have other components, such as GPUs, registers and cache memories, but we don’t consider those computer architecture basics.

CPU

The core of computer architecture basics is the CPU, the Central Processing Unit. This is a small chip that runs the software, it is the only part of a computer able to execute instructions. Those instructions are relatively simple mathematic operations, executed in binary numbers because computers can understand only binary numbers.

Yet, even with just basic math operations in binary number, the CPU can do all the magic of modern computing: it can print stuff on the screen, play a video, call your mom, edit some text, run your favorite game, and so on. Even the most complex task, eventually, is rendered in simple CPU instructions that can be executed.

Nowadays, with CPU we mean the chipset that you install on your machine, such as Intel i7 for example. However, in computer architecture basics we mean CPU cores. If you were ever shopping for a CPU, you had seen for sure “dual core”, “quad core”, “octa core” and so on. That is the number of processing units the CPU chip carries, or, to be more precise, the actual number of CPUs on the chipset.

Having more CPUs is better because it allows us to execute more programs in parallel.

Memory, RAM

In computer architecture basics, whenever we say memory we mean RAM, Random Access Memory. This is a type of memory that is non-persistent, that is it loses all the information when the computer is powered off. However, it is extremely fast to access: data can go from the CPU to RAM and vice versa very quickly.

The role of this memory is to host your data and programs that you are working on right now, the programs in execution. In the end, a program is just a set of instructions the CPU has to follow. Those instructions can be represented in binary numbers, which are stored in the RAM. Then, with every CPU cycle, a new instruction is fetched from RAM, brought into the CPU, and executed. This cycle continues to repeat until all the instruction of your program are execute.

Note that with program we literally mean any set of instructions, it can be a game, a word processor software, or even something else.

We call it Random Access Memory because your program and data can be in any place of the RAM (hence Random), and because no matter where in the RAM a piece of data is, the speed to access it is always the same.

Permanent Storage (HDD, SSD)

Permanent storage is storage meant to save your data, files, and programs when you are not using them, even when the computer is shut down. This is why we call it permanent. It is much cheaper than RAM (1GB of permanent storage costs way less than 1GB of RAM), but it is also much slower. With slower, we mean that it is orders of magnitude slower than RAM, million times slower.

There are two technologies for permanent storage, HDD and SSD. Hard Disk Drive, HDD, is the older technology, data is stored on magnetic disks that have to rotate to be accessed. It is the slower of the two, but also the cheaper and the one that can boost higher capacities. On the other hand, Solid State Drive, SSD, is the newer technology which as no disk or moving part, everything is managed through electronics. It is faster, because you don’t have to wait for the disk to physically spin to reach your piece of data, and less prone to breaking because it has no moving parts. It is more expensive than HDD, but still cheaper than RAM.

Because permanent storage is million times slower than RAM (even in SSDs), CPU cannot access it directly. If you want to execute a program or read some data, it first needs to be moved to the RAM to be accessed. To make an analogy, imagine you have a library and you want to read a book or write on a notebook. First, you need to go to the bookshelf and fetch the book you want (you have to remove it from permanent storage). You carry your book to the desk (in the RAM), and here you do what you need to do. Once you finish, you put it back on the shelf (the permanent storage).

Devices

We couldn’t finish our list of components for computer architecture basics without mentioning devices. Those are the things that make computers actually useful, because they allow them to interact with the external worlds and humans.

Imagine a computer with no screen, no mouse, no keyboard, no speakers, ad no network connections. It wouldn’t be of much use, would it? All those are devices, and as you can see each has a different role: the screen can display text, videos, and images; the keyboard can receive text input from the user, and so on.

Those devices are connected through a bus, a special connection that makes them accessible to the CPU. Each has a buffer, a small memory similar to the RAM. The CPU can read and write data from this buffer, allowing for the interaction with the device.

For example, a screen will have a buffer representing all the pixels on the screen. The CPU can write into each and every pixel in the buffer to set its color, and then the screen will render the image on screen. Likewise, the CPU can read from the buffer of the keyboard to fetch what the user was writing. Have you ever been in a situation when you write something and nothing appears on screen, until everything appears all at once? The CPU was very busy and overloaded, and had to delay reading the buffer which filled up with your text in the meanwhile.

Processes for Computer Architecture Basics

Programs vs Processes

A computer is only useful as it is its software. Just like in the truck-driver example we made previously, the hardware would do nothing without the driver, and the driver is the software.

Software is a broad category of things, specifically it means a collection of programs. A program is just a piece of software that does something specific. For example, Google Chrome is a program that allows you to browse the web, Microsoft Word is a program that allows you to edit text, Adobe Photoshop is a program that allows you to edit pictures, and so on.

Actually, a compete software like Chrome, Word, or Photoshop is often not just a single program, but a set of multiple smaller programs. The people who develop these pieces of software chunk their operations into different chained and nested programs for various reasons, such as because it is easier to write code in this way and because of performance. Nonetheless, the experience for the user is that you are interacting with a single piece of software. To make it clearer, each tab in Google Chrome is its own program and process.

So, a program is a set of instructions that allow the computer to do something. A process is a program in execution. As simple as that.

Running a Process

When you launch a program, its process equivalent spawns. Launching a program means the program is not in execution at the moment, but you want to execute it. So, it means the program is sitting just in the permanent storage.

Whenever you launch a program, a new copy of it is created in the permanent storage and then, if possible, moved to RAM. We say if possible because RAM is smaller than permanent storage, and so there is a chance that is already full. It will be the operating system to decide which programs can go into RAM and which ones are to be moved out temporarily. This is the Long-Term Scheduler of the Operating System.

Once in RAM, the CPU can fetch the program line by line and execute it. The program can also interact with devices, and when it does that, we say it is doing I/O (read just “I O”, for “Input-Output”). Eventually, the program finishes, and it is moved away from RAM. It is terminated.

The operating system has one main goal here: keep the CPU utilization to its maximum. Time in the CPU is expensive, so none should go wasted. If there are CPU that needs to go to the CPU, but the CPU is sitting idle, it means the OS is not doing a good job. This can happen if no process that needs the CPU is in the RAM, but they are all in HDD/SSD. While we move them to the RAM, the CPU has nothing to do: its time is wasted.

How a process is moved to RAM and executed according to computer architecture basics
A process is spawned and copied to RAM for execution.

Hence, the CPU will try to have in RAM the process that are most likely to be executed next. In modern computers, in fact, the CPU can run one instruction from a process, then an instruction from another process, and so on. This is because the CPU is a “dumb” component with no state in the end, that is it just executes instructions and forgets everything. All data is stored in the RAM. So, you can run an instruction and update the data in the RAM, and write down the next instruction to execute for that program. Then, the CPU can execute another program, and then a while later resume on the original process where it had left it.

The piece of memory to store where we need to resume execution, much like a bookmark, is called program counter.

Process Control Block (PCB)

When talking about computer architecture basics, we really need to mention the PCB.

The Process Control Block, or PCB, is how a process is stored in RAM. It will have four main parts:

  1. The process itself, which is the code of the process that the CPU needs for execution
  2. Global and static variables, values that can change over the course of execution
  3. The stack, to keep track of function calls
  4. The heap, to allow for usage of dynamic memory allocation

These four things together make the process control block, which effectively represent a process in execution with all its data. As you can see, the process itself is only one part (the first), the other three relate to its data.

This is important, because a process with no data is not worth much. Adobe Photoshop wouldn’t be useful if you wouldn’t be able to load pictures in it (the data), same for Microsoft Word if you had no possibility of editing text (the data).

In this definition, we mentioned function calls and dynamic memory allocation. Those are concepts that a programmer may have crystal clear, but that are not so evident to the average person. Going deeper into them will take us way off course from this computer architecture basics crash course, but if you want to learn more about them you can learn the basics of C programming.

Computer Architecture Basics in Summary

In this quick guide on computer architecture basics, we saw how computers are structured to make our world work and solve our problems. We started with an overview of the basics of computer architecture, moved to the hardware components of a system, and then detailed how programs and processes make use of this architecture.

Now you conquered computer architecture basics. You have all the tools to go tackle your computer science courses and understand better how the world of IT work. Make good use of this knowledge. From here, you may continue by learning more about binary math and numbers.

Picture of Alessandro Maggio

Alessandro Maggio

Project manager, critical-thinker, passionate about networking & coding. I believe that time is the most precious resource we have, and that technology can help us not to waste it. I founded ICTShore.com with the same principle: I share what I learn so that you get value from it faster than I did.
Picture of Alessandro Maggio

Alessandro Maggio

Project manager, critical-thinker, passionate about networking & coding. I believe that time is the most precious resource we have, and that technology can help us not to waste it. I founded ICTShore.com with the same principle: I share what I learn so that you get value from it faster than I did.

Alessandro Maggio

2021-12-09T16:30:00+00:00

Prime Opportunity

Dev

1600