Rabi Siddique
763 words
4 minutes
The Basics of Computer Science
2024-08-10

Credits: Wacky Science

At first glance, computers might seem like boxes of metal that somehow transform your keystrokes into the wonders of the digital world. But have you ever stopped to wonder what exactly is going on inside that box? How does a seemingly lifeless assembly of silicon and metal become a powerful machine that performs billions of calculations every second? Let’s break down the complex world of computers into something a bit more digestible.

The CPU#

Credits: Wacky Science

At the heart of every computer lies the Central Processing Unit (CPU). The CPU is just a piece of silicon.

Credits: Wacky Science

This piece of silicon contains billions of microscopic switches known as transistors.

Credits: Wacky Science Credits: Wacky Science

These transistors function like light bulbs—they can be either on or off.

Credits: Wacky Science Credits: Wacky Science

This binary state (on or off) gives us two possible values: 1 and 0.

Credits: Wacky Science

This on-off state is fundamental to how computers operate. Each switch represents a bit, the most basic unit of data in computing.

Credits: Wacky Science Credits: Wacky Science

A single bit, by itself, isn’t very useful—it’s just a tiny piece of information. But when you combine bits, interesting things start to happen.

Bytes#

A byte is a group of eight bits.

Credits: Wacky Science

And it can represent 256 different combinations of 0s and 1s.

Credits: Wacky Science

With these combinations, computers can store and manipulate data using a system called binary.

Every bit represents a power of 2.

Credits: Wacky Science

One means the power is included.

Credits: Wacky Science

And zero means it’s not.

Credits: Wacky Science

So this number has 1 times 64, 1 times 4, and 1 times 1 which gives us 69.

Credits: Wacky Science

Hexadecimal#

However, binary isn’t the most human-friendly way to represent data. This is where hexadecimal comes in. Hexadecimal, often denoted with a 0x prefix, is a more readable format than binary.

Credits: Wacky Science

Each group of four binary bits can be represented by a single hexadecimal digit (0-9 and a-f), making it much easier for us to interpret complex binary sequences.

Credits: Wacky Science

Logic Gates and Boolean Algebra#

So, now that we can store numbers, how do computers actually do something with them? This is where logic gates come into play.
Using transistors, we can make logic gates.

Credits: Wacky Science

Logic gates are electronic circuits that perform logical operations, kind of like a series of light switches that control whether a light bulb turns on or off based on specific conditions.

Credits: Wacky Science

By combining these logic gates in clever ways, computers can perform complex calculations using Boolean algebra, a system that formalizes mathematical operations in binary.

Credits: Wacky Science

Translating Binary to Human-Readable Text#

While computers are happy dealing with 0s and 1s:

Credits: Wacky Science

We humans prefer something a bit more intuitive.

Credits: Wacky Science

Enter ASCII (American Standard Code for Information Interchange), a character encoding standard that assigns a binary number to each character.

Credits: Wacky Science

When you type a letter on your keyboard, it gets translated into binary, and the computer recognizes it as a specific character. Say, a capital “A.”

Credits: Wacky Science Credits: Wacky Science Credits: Wacky Science Credits: Wacky Science Credits: Wacky Science

A capital “A” is represented by the ASCII code 65, which in binary is 01000001. So, whenever you type an “A” on your computer, it’s encoded as this 8-bit binary sequence, with each bit being represented by a transistor in your computer’s circuitry.

Credits: Wacky Science

Kernel#

Credits: Wacky Science

These components work together because of the system Kernel. The operating system kernel acts as a mediator, sitting between the computer’s hardware and the applications you use. Credits: Wacky Science

It manages how everything interacts, ensuring that each part of your computer communicates correctly, whether it’s sending data to your screen or receiving input from your keyboard.

CPU and RAM#

At the lowest level, computers only understand instructions in machine code—binary code that directly tells the CPU what to do. The CPU is incredibly fast and can execute billions of these instructions every second. However, the CPU itself has no memory; it relies on Random Access Memory (RAM) to temporarily store data and instructions.

Credits: Wacky Science

RAM can be visualized as a grid where each box can hold a byte of information which can be data or instructions.

Credits: Wacky Science

Each box also has an address so that the CPU can access it in 4 steps. The CPU accesses this memory in a cycle called the fetch-execute cycle : it fetches data from memory, decodes the instructions, executes them, and then stores the result. This is one machine cycle. Credits: Wacky Science

This cycle happens billions of times per second, allowing your computer to perform tasks at lightning speed.

Further Reading#

The Basics of Computer Science
https://rabisiddique.com/posts/computer-science/
Author
Rabi Siddique
Published at
2024-08-10