How do you start learning about computer data in a low level /language exempt format?

When I asked this question prior, I was usually told I did not need to go as far as the physical magnets and voltage lights on a board to understand binary and coding data types, but I began to feel very stuck studying intro to algorithms. Right now, I don’t truly understand data and memory. When I imagine the lowest level, I just imagine this large array of blinking lights. Even though I have watched intro to (language) tutorials, I never truly understood the idea of addresses, references, container data types, and defining relationships between data.

I don’t really understand how we define characters and numbers. I roughly assume we assign a symbol to a certain set of bits/blinking lights in the computer. yet I don’t really understand how we code the symbol itself into the computer, how do we implement the visual character ‘r’ or ‘2’ ?

Moving on to data types such as integers, I don’t understand how we code inequality, for example. How do we code that int 1 is “bigger” than int 2?
Any sort of relationship or command is also hard to understand, such as if statements. how do we tell the computer that if this set of lights is on, then we must execute this line of code? Is an ‘if’ statement also stored in memory as some sort of object, when instantiated the same way a data type such as ‘int 2’ is, even though statements in programming are commands? Do statements also have addresses?

Another issue is the idea of references, and pointers as a type of reference.
data such as ‘int 2’ or maybe an array element array[1] = 2 or a node in a linked list has an address which is not the actual element, such as ‘2’, but some assortment of symbols such as ‘@a3fbk’ does an address itself hold memory, where are addresses stored?
why do we need an address alongside what should assumably be a set of binary code/pattern of lights inside the computer?
I never understand when studying different data structures that are better or worse for memory because I have no concrete idea of what memory is as well as data.

Where could I start?

Great question

I’ll try my own explanation of this and try to provide a few resources.

At the most basic level everything is encoded in binary data, 1 or 0, which is encoded on a physical layer as positive voltage charge 1 or no voltage 0.

You can think of ships signalling across the water using morse code, and flashing a light. This is a binary signalling system, kind of a really bad computer, but they can use it to transmit data.

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

You can see how morse code takes binary (on/off) signals and packs it together to represent more complex ideas:

.... . .-.. .-.. ---
H    e l    l    o

So computers store binary data as a charge or no charge in memory or magnetic disks.

The rest you can imagine as layers of abstraction. At a low level you can only perform simple tasks like change the charge from positive to negative, move groups or patterns of charges from one area of the storage medium to another and you can do binary addition.

Some of this is implemented in physical circuits on the CPU. You could read about logic gates to learn about this electrical CPU level programming: https://www.geeksforgeeks.org/logic-gates/

This is implemented in hardware. You will have a physical chip with little metal legs and inside is an AND gate. If it gets positive charges on pin 1 and pin 2 (labelled on the diagram) input legs, it will send a positive charge on the output leg 3. A physical electrical process. You can combine these gates into different combinations to perform logical operations like addition and other math. This is basically what a CPU is.

So that’s the bottom layer, binary, 1 and 0, electrical charges in circuits which can be combined to perform basic math and logical functions. That’s machine code.

The next layer up might be the ASSEMBLY programming language which interacts with memory addresses directly using simple instructions like MOV which moves some 1s and 0s in one memory location to another or ADD. This is implemented by logic gates in the computer hardware. This is an abstraction of the lower level so you don’t worry about changing voltages directly, you just work with data in memory.

Since numbers in binary are very long, you use Hexadecimal in assembly.

101101001011
B4B

It’s a lot easier to type B4B but when that gets stored as voltages the computer translates it into binary. Everything works like this, translations from easily readable text, code or images on a screen and translated down a system of layers into binary and then voltages in memory or disk.


https://www.learncomputerscienceonline.com/instruction-set-architecture/

About Assembly: https://www.youtube.com/watch?v=4gwYkEK0gOk

Everything else is a continual abstraction away from machine language and to a higher level, more human friendly language. All of the logic, like an IF statement is implemented at lower and lower levels.

A one line IF statement might be 20 lines of ASSEMBLY code and 50 electrical operations in the CPU. It doesn’t translate EXACTLY like this, but this is how the layers of abstraction work.

Hello!

if x > y:
print("Hello!")

0x07f4 <+0>:    sub  sp, sp, #0x20
0x07f8 <+4>:    str  w0, [sp, #12]

00110100101101001000111010
11111000111001010011100011
01001110011001100110100101
10100100011101011111000111
00101001110001101001110011

See how an if translates to assembly here:
https://diveintosystems.org/book/C9-ARM64/if_statements.html

I think this video will be very illuminating as well as how things are encoded: https://www.youtube.com/watch?v=F9-yqoS7b8w&list=PLhQjrBD2T381WAHyx1pq-sBfykqMBI7V4&index=5

I hope this helps!

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.