Course Introduction to Programming
Hardware
In this lesson, we will learn the basic concepts of Hardware, understanding how the main parts of a computer work.
We will explore the Von Neumann architecture, understand the role of the motherboard, analyze the different types of memories, get to know the input and output devices, and also see the importance of the GPU.
Von Neumann Architecture
The Von Neumann architecture is a fundamental model that describes how computers process information. It divides the system into key components:
- Central Processing Unit (CPU): Think of the CPU as the brain of the computer. This is where all program instructions are executed and data is processed. It is composed of two main parts:
- Arithmetic Logic Unit (ALU): Responsible for performing mathematical calculations (addition, subtraction, etc.) and logical operations (comparing numbers, checking if they are positive or negative). For example, when your code needs to add two values, the ALU is the one that does it.
- Control Unit (CU): Manages the flow of instructions. It doesn't do calculations, but it fetches instructions from memory, decodes them, and executes them in the correct order. It ensures that everything happens at the right time, telling each part what to do and in what order.
Figure 1 : Imagem de uma CPU
- Memory: This is where the computer stores data, programs, and instructions for the CPU to use. This memory can be short-term or long-term. Examples include HDs, SSDs, CDs, and Pen Drives.
The relationship between these components can be seen in the image below:

Figure 2 : Relaรงรฃo entre os componentes
Thus, the process generally occurs as follows:
- Input Devices send data and commands to the system.
- Memory stores this data and the instructions of the programs the computer needs to execute.
- The CPU (through the CU and ALU) fetches instructions and data from Memory, processes the information (performs calculations and decision-making), and, if necessary, stores the results back in Memory.
- Finally, the processing results are sent to the Output Devices, allowing you to see or hear the result of the operation.
Practical example:
Practical example: You type
2 + 3
.
- The keyboard (input) sends it to memory.
- The CU interprets the โaddโ instruction.
- The ALU calculates
2 + 3 = 5
.- The result is stored in memory.
- The monitor (output) displays 5.
Therefore, in summary, the cycle works as follows:
Input โ Memory โ CPU (CU + ALU) โ Memory โ Output.
โ ๏ธ Although the Von Neumann architecture has been the basis of modern architecture, it does not faithfully represent the architecture used by current systems.
Motherboard
The motherboard is the main circuit of a computer, where all other parts are connected. It functions as the connection hub, interconnecting all components (CPU, memories, input/output devices, HD/SSD, video card, etc.) while ensuring they communicate correctly and providing power and physical support for each part.

Figure 3 : Imagem de uma placa mรฃe
Memory
The computer's memory is where it keeps temporary or permanent information it needs to function, and it can be divided into two main categories:
Primary Memory
Interacts directly with the CPU, being divided into:
- RAM (Random Access Memory): is a volatile memory, meaning that whenever the computer is turned off, it will lose all stored data. It is responsible for storing the data of programs that are currently being executed. An example is when you open a game, it is loaded into RAM.
- ROM (Read-Only Memory): is a memory where it is only possible to read information; it is not possible for our programs to store data in it. It is mainly used to store data that should not be overwritten, such as the program responsible for controlling hardware parts, like the motherboard, mouse, and keyboard, the program that starts the operating system (BIOS/UEFI), being non-volatile (it doesn't lose data when the computer is turned off). It stores fixed information essential for the initial operation of the computer.
- Cache memory: is an ultra-fast memory located inside or very close to the CPU. It temporarily stores the data and instructions that the processor uses most frequently, preventing it from having to fetch this information from RAM, which is slower. An example is when you are playing a game and the processor needs to repeat the same game physics calculations many times: instead of going to RAM each time, it gets it directly from the Cache, speeding up execution significantly.
Secondary Memory (storage)
It is not accessed directly by the CPU; it needs to go through RAM first. It is divided into:
- HDs (Hard Disk Drives): its main function is to store large amounts of data. The HD is where photos, videos, documents, and games are stored. Today it is considered slow because it uses a mechanical needle to access data.
- SSDs (Solid State Drives): have the same function as an HD, but they use newer technology and do not have mechanical parts to access data (they use flash memory chips), for this reason they are faster.
- Removable devices: Pen drives, memory cards, CDs, DVDs.
Figure 4 : Imagem de mรณdulos de memรณria RAM conectados ร placa-mรฃe
Input and Output Devices
An input device is a device that provides any information to the computer, allowing interaction between you and the computer. For example:
- Mouse: which provides information regarding the cursor's movement.
- Keyboard: which provides information on which characters were pressed.
The output devices, on the other hand, serve to transmit information from the computer to the user. The main output device is the monitor, as it is responsible for informing the user about everything that is happening on the computer.
GPU (Graphics Processing Unit):
It is the "graphics processor" of the computer, being excellent at performing many simple operations simultaneously. It is responsible for processing images, videos, animations, and visual effects in games, editing programs, 3D modeling, and even some artificial intelligence tasks nowadays.

Figure 5 : Imagem de uma placa de vรญdeo (GPU)
Conclusion
By understanding how these parts work together, you will be able to write more efficient and optimized code, knowing where to look for performance bottlenecks if your program is not running as expected. Everything you learn about hardware helps you program better:
- Knowing that RAM is limited makes you write more optimized code.
- Understanding that the CPU executes instructions step-by-step helps to avoid unnecessary loops.
- Knowing the GPU helps to use parallelism in heavy calculations.
The better you know the computer, the faster and more efficient your code will be, in addition to making it easier to test complex ideas!
Now you know all the basic concepts of Hardware and which main parts make up a computer ๐