Wednesday 9 December 2015

PRIMARY MEMORY!!

Memory is needed to store data and retrieve it when needed. Computers have two kind of memory, one is primary and another is secondary.
Secondary memory is described in the previous article.
Primary memory is needed to execute any program. Our program when executed loads itself into primary memory. When program runs, it needs to work on variables, objects, data structure etc. to store data. For instance to store int a; user will input a(lets say an operation) and it will be stored in primary first and then if commanded to store then will store in secondary memory
Primary memory example could be RAM, ROM, Registers etc. Processor works as a primary memory too since they have limited storage too.
Primary storage, also known as main storage or memory, is the area in a computer in which data is stored for quick access by the computer's processor. 
The reason why primary memory was required, is it speeds up the processing. Secondary memory is also used for this purpose sometimes. When RAM ran out of space to open new files, the OS uses Hard disks as primary memory by creating page files on that. If you have seen pageswap or page files in your system's hidden files then you have seen the proof.
Now why do we need it? We need processors to run the commands, however processors are really costly and they can not hold much data in them. Processors are really fast, but we need to store the data processors are not currently using, even in the running program. Caches are faster kind of memory which can be used by Processors very easily. However they are costly too (L1 is faster and costly than L2). Registers are next faster memory and RAM is the next fastest and the cheapest option.
RAMs can't hold the data, so we need a persistent data storage such as HDDs. HDD works on magnetic resonance principles and are really slow. However they are faster than Optical disks such as CDs and DVDs. SSDs are faster, but they still can't compete with RAMs. RAMs are electronic drives which can connect with Processors with ease.

No comments:

Post a Comment