# Cant understand visually what main memory is

According to my university's notes the main memory is made of a consecutive number of positions, each of them contains the same amount of binary digits. Every position corresponds to a unique address which is what the CPU uses as reference to load from the memory. However I can't visualize this. Is the main memory some form of a grid, in which each cell has a unique address and that is what the CPU uses as reference to load data from it?

• You should ask your TA or lecturer to explain this to you. Nov 9, 2022 at 20:25
• The CPU does not see a "grid". A "grid" implies two dimensions; but memory addresses are linear (specifies an offset in a single dimension). Main memory is like a one-dimensional array, with the memory address used as the array index. Nov 10, 2022 at 6:01

I would say the short answer is basically, yes. In a typical modern computer, the most specific level, or the lowest level, that can be addressed, is a single byte. Then, within a single byte, there are 8 bits. Physically, it doesn't really matter how the main memory is laid out.... you could think of it as a grid if you like. Realistically, for the purpose of using main memory, it really is just one really long sequence of bytes, which you can use to do useful things with your program. (It really does boil down to that... memory addresses start at 0, and go all the way up to the highest numbered byte in memory).

• So it is a grid , each cell of the grid holds 1 byte and each cell has a address which is what the CPU uses as a reference to load data from it?? Nov 9, 2022 at 20:31
• Honestly, I actually would not think of it as a grid. The best way to think about it is, truly, as one gigantic sequence of bytes. The true physical layout in the computer doesn't matter from a software standpoint. However, yes, 1 cell is 1 byte. (To pick out, or do things, with specific bits, you have to use bitwise operations / bit masking.) Nov 9, 2022 at 20:34
• Note that byte doesn't necessarily have to have exactly 8 bits - although it does in computers we use day to day. Historically there existed eg. 7-bit bytes, which is what ASCII is based on. If you want to be precise or you're dealing with systems that use different-sized bits, you can use the word "octets" - commonly used when discussing networking. Nov 9, 2022 at 20:38
• @gronostaj ASCII is a 7-bit character set but it exists comfortably in an 8-bit environment, just with the high bit cleared. I can't think of any systems that used a 7-bit byte other than the Minsk-32. I have used systems with a 6-bit byte (Harris) and 9-bit byte (DEC). Wikipedia confirms the 6 and 9 bit byte sizes as common in the past. Nov 9, 2022 at 21:28

Visualize boxes arranged in a straight line. They have a fixed order and are labeled starting from 0. These are your memory cells with their addresses.

In each box there's a DIP switch:

It has a number of switches that represent bits (typically 8 of them): lower position is 0, upper is 1.

CPU will address memory cells (boxes) by their addresses (labels). It can read and write values to any address (look up and set the switches).