In this article we will talk about Computer Storage Hierarchy. There are different storage devices that we have in our Computer System. This is important to know when studying Operating System . So here we will learn what are the functions various storage devices have and what are the features they offer. Bellow we have illustrated the storage device hierarchy. As we go up to the hierarchy, devices are expensive but fast and efficient. Lower devices in the Hierarchy are cheap but comparatively less efficient.
Storage devices are mainly three categories: Cache Storage or Processor Memory, Main Memory also refers to as Primary Storage or RAM, and Secondary Memory. Although Cache Memory and RAM both are_considered as Main Memory. Below we will describe them shortly.
Registers are the most basic storage components in Computer System. Combining a group of LATCHES create a register. It stores the bits of information, 0s and 1s. Therefore registers are the smallest in capacity, but their access time is the fastest. So registers are the most efficient storage devices. Any instruction that needs to be executed, CPU must access it from the Register. Learn more about Register.
Cache Memory | SRAM
Cache Memory presents in the Processor itself. This Memory is extremely fast compared to the Primary or Secondary Memory. But compared to the Register it is not that fast. Only the current instruction from the complete program that needs immediate execution goes to the Cache Memory from the Primary Memory for faster access.
If a CPU of 2.5GHz clock speed wants to access data from 1866 MHz RAM then it is impossible for the RAM to deliver data to the CPU at that speed. Also if the two 2.9 GHz cores of a CPU ask for instruction simultaneously then RAM is unable to deliver data to all of the cores at that speed at the same time. That’s why the Static RAM (SRAM) or Cache Memory comes into play. The typical size of the Cache is in the range of few KBs upto few MBs. So the Cache memory is necessary for delivering data that is frequently required by the CPU.
There are Level 1 or L1, L2, and L3 Caches for a CPU. As L1 Cache is inside the CPU for every individual core, therefore it can operate at the same speed of CPU. That’s why L1 cache is the fastest among all Caches. Again, L2 cache can be either inside the cpu or it could be outside the cpu. It could also be shared for all cores or it could be individual. But in term of speed L2 is slower than L1. Finally, the L3 Cache. Mostly a higher end processor will have a L2 cache. All the cores in the cpu share the L3 cache. It is outside of the cpu. it helps enhancing performance of L1 and L2 caches.
RAM is the most important part in Storage Hierarchy. In Secondary memory when we start a program, Operating System moves the complete program and its data to the main memory before processor may refer them. This is because Secondary storage is not fast enough to deliver data as required speed of the CPU. Therefore OS loads the data to RAM so that CPU can access it of it’s required speed.
For example suppose we have a text file in our computer hard disk (Secondary Memory). So when we double click to open the file, the data along with entire associated program gets loaded into the Main Memory. Otherwise it stays into the Secondary Memory. Thus when a computer has a larger capacity RAM it runs faster.
Secondary Storage includes Electronic Disk, Magnetic Disk, Optical Disk, and so on. The primary memory is fast, but it’s capacity is limited, also it is volatile. Which means any data on the volatile memory is not permanent. But the reason we use the volatile memory is because of accessing data faster.
On the other hand data on the secondary memory is approximately permanent. Also it is not possible to store any program into the Main memory. Hence we need the secondary memory in our computing system. So that in Secondary Memory we can store our program and all necessary data. But, if we need to run or execute any program then it loads into the Primary or Main Memory. Which means all data resides in Secondary Memory, but at the time of execution System loads the data into the Main Memory (for faster access). Thus we can say that Secondary Storage devices store data and programs that are not actively_accessed by CPU. Learn more about Storage and Memory
In this section we will discuss about how process is_organized in the Main Memory. There are various ways OS manages or utilizes Memory Spaces. Such as: OS can let one individual process to use entire Memory Space. Also that the Operating System can allocate specific partition of memory for each individual process. This allocation process can happen Dynamically or Statically.