Computer Memory via Human Memory
When I started the low level track at Holberton School, I wanted to understand what computer memory is, and how it works. Having had a background in Psychology what helped me with a high level understanding is to compare it with human memory. Of course its much more complex and detailed, but this was a good starting point for me.
Lets first see what google says when you type memory, “the faculty by which mind stores and remembers information”. Well! yes, be it computer memory or human memory, its about storing and using some data. Usually when we talk about human memory we quantify it in terms of storage capacity and duration, for which computers equivalent would be its storage area in bytes and retrieval time.
Human memory can be divided into three main components(Atkinson and Shiffrin, multistore model of memory): Sensory memory, Short term memory and Long term memory. Similarly computer memory can also be divided into Cache, RAM and Hard disk.
According to atkinson-shiffrin model, human memory starts with sensory input from environment, where filtered and attended information goes to short term memory and processed for current use and after practice and rehearsal gets stored in long term memory. Similarly, in a computer when you write a program or create a text file, whatever input it gets from your keyboard it first gets stored in RAM, processed, used and then if needed goes into hard disk.
When you meet new people at an event, you hear many new names and can only attend to registering few of them, some of them you may forget immediately or next day and may be one person’s name who you happen to meet again and again goes into your LTM. Now every time when you meet this person, she/he doesn’t have to tell you their name, rather you recall it from your LTM, loads it in STM and use it. Similarly, when you start your computer, programs that are stored in its hard disk are read from and loaded in RAM, and then what cpu processes gets stored in cache for quick usage.
Sensory Memory and Cache
- stores information gathered by sense organs.
- preprocesses and filters the information.
- information stays for few seconds, overwritten and lost.
- passes on attended information to STM.
- is very little memory space.
- super fast for information access and processing by CPU.
- serves information that may need to be reused.
- overwritten with new information.
It may be an over stretch to compare sensory memory and cache because they serve different purposes. So its important to be cautious here in seeing them as similar only in terms of information storage capacity and loss.
STM and RAM
STM: Short term memory
- also known as working memory.
- can only hold up to 7+/-(2) items at a time.
- recent information is recalled from STM.
- forgotten with new information.
RAM: Random Access memory
- is limited in size, for example, my macbook pro have 16 GB RAM which is not alot but still good enough to store 3 to 4 2 hour movies.
- provides quick access but still not fast enough like cache.
- information is lost/stored in hard disk when the computer is turned off.
LTM and Hard disk
LTM: Long term memory
- have huge storage capacity.
- stores information for very long periods of time, sometimes permanently for the entire life time.
- information that is rehearsed and practiced goes in LTM.
- can take long to recall information stored in LTM.
- huge storage capacity, my macbook have 251 GB of hard disk space which is like storing approximately 80 movies of 2 hours.
- stores permanently, unless removed
- all the programs and files are stored in hard disk.
- takes time to access information from hard disk.