Preslav Mihaylov

Speaker, Software Engineer, Technical Trainer. Passionate about computer science, presenting and playing board games

Computer memory

This article is part of the series What you won’t learn in the basics courses and is aimed at people who have an understanding of programming, but want to gain a more deeper insight on how things work and why do they work that way.

For nearly two years, I have been leading programming basics courses. During this time, I have always wanted to deliver more knowledge to the students, than was intended in the course program.

However, I haven’t been able to find enough time during lectures to share this knowledge, so I decided to make a series of blog posts about fundamental topics in programming and computer science, which seem to be skipped in regular programming basics courses.

During lectures, we usually focus on topics solely concerned with creating the computer program. Sometimes, we refer to notions such as “memory” and “instructions” but what does that mean? What exactly is memory? How does the computer use it? How does the computer execute “instructions”?

When I started out with programming, these words seemed pretty abstract to me. I assumed some things about these words, but it was all black box for me. That is why, I have decided to give you a quick introduction to what memory and instructions are. This post, I will solely cover memory, and next time, I will share with you how does the processor work and use memory.

What does a computer consist of?

What are the two most fundamental components of a computer? – The processor and memory.

Computers in their basis, consist of only one thing – data. It has to be stored somewhere. That is why a computer needs memory. That is, something that keeps data for some period of time. Apart from keeping it, we have to manipulate it somehow. That is where the processor comes in handy.

Different kinds of data

Some of the data might be used frequently – let’s say, the position of the player in a game is something which is being read and written all the time while you are clicking the WASD keys.

Other data can be used more rarely. For example, you could watch your favorite action movie once a month.

Therefore, for the more frequently used data, we need memory which is fast to access. When you move your character in-game you have to change hisĀ position a lot of times in a second. If the memory is slow to access, we would have what gamers use to call “lag”. That is when the game is not running smoothly.

For the more rarely used data however, we need memory which lasts long. If you download an Iron Maiden song today and you play it in a month, you expect to hear the Iron Maiden song and not the Britney Spears song right? Or even worse, it can be totally gone. Now, it is questionable whether the latter is worse or not but in both cases, the outcome is not cool.

Unfortunately, there is no such memory that can satisfy both requirements. One kind of memory could be either quick to access and volatile (that is, its data can be easily lost) or it can be slow to access and non-volatile.

Volatile memory

That we usually call the RAM memory. It is used for data that needs to be accessed quickly, that is why it is based on electricity. So, whenever you execute a program, you actually load its instructions and required data to run in the RAM memory. After all, you want your favorite game to run smoothly right?

However, RAM memory is lost whenever we shut down the computer. That is why we can’t keep everything in RAM and expect the computer to be faster overall.

Non-volatile memory

Well what about all those photos and movies you want to keep for a longer period of time (in comparison with your HP in a game for example)?

For that, we have hard disks. Their purpose is to keep data for a longer period of time. However, in contrast with RAM, hard disks are extremely SLOW. That is because they are based on mechanics. A hard disk is actually a bunch of metal disks which spin very fast and a writing head “scratches” them in order to write or read data. You can watch this video to see the inside of the hard diskĀ for yourself.

But despite the fact that the disk is spinning fast, it cannot be faster than the speed of electricity.


So there you have it! A quick introduction to the memory of a computer. Next time you write a variable in your program and someone says “you load this in memory”, you will actually understand the whole process. Furthermore, next time you go to an online shop looking for a laptop, you would know what are the benefits of more or less RAM. When I was little, I used to think that more RAM means a faster computer. However, now you know that that is not always the case right?

Next time, I will share with you some insights on how the processor works and what is his purpose.

And what would you want to learn about? Leave me a comment below if you have any suggestions or questions.

Leave a Reply

Your email address will not be published.