Computer Science Tutorial
Random Access Memory
RAM stands for Random access memory. It is the primary memory for computer. Because it performs some very primary functions which is essential to computer functioniing. All the programs whether system programs or user programs need to be loaded into the RAM for cpu to execute it.
Why RAM is called random memory?
The reason behind being called as random is, cpu can access any memory word randomly within the RAM. So, RAM can be accessed non serially. Being random in nature, CPU is able to access data in any order. But this is not possible in case of secondary memory like ROM, because it is a serial memory. CPU always accesses fixed memory location within the ROM which is generally at the start of the ROM chip.
Why RAM is called volatile memory?
RAM is made up of capacitor and transistor. Capacitor is the actual component which stores data as charge, 1 or 0. Since capacitor is leaky in nature, that means it can not hold data for a long period of time. So data stored in RAM is vanished in just every milli second and hence RAM need to be refreshed periodically for cpu to use it. Generally RAM is refreshed thousand time in every seconds to retain the data.
How does CPU accesses the RAM
For CPU to work efficiently it needs to access the data as fast as possible. Programs are generally found in secondary memory. When a programs runs for the first time CPU searchees in memory which is near to it that is registers and main memory. Not finding in any primary memory, the cpu accesses the secondary memory and loads the necessary block from secondary to primary memory. CPU generally accesses the memory as a word. The word size actually depends on computer architecture. In 32 bit machine the word size is 32 bits and for 64 bits machine, the word size is 64 bits. CPU accesses one words at a time from RAM and stores in an intermediate memory, called cache memory. Next time CPU needs the same data or instruction it accesses the cache memory first, if not found inside cache, ram is accessed.
How does RAM affects CPU speed?
CPU can access its registers in a single cycle of cpu clock, because registers are in built within the cpu chip. But RAM are separate chip and lies outside the cpu and in order to access the RAM, the request goes through a carrier called memory bus. The speed and size of this bus very much controls the speed with which CPU can access RAM. RAM also has its own clock frequency slower than the CPU. These two factors slows down the CPU to some extent. So, CPU can not access RAM in a single clock cycle and it wastes more than two, three or more clock cycles to access RAM. This affects overall computer performance.
So, in order to increase computer performance, the speed difference between the two must go down. This can be achieved in multiple ways. Upgrade the memory bus and RAM itself. Another technique is cache memory.
Types of RAM
- Static RAM(SRAM)
- Dynamic RAM(DRAM)
What is Static RAM
Static RAM is fast and generally used in systems cache memory. It needs 4 to 6 transitors to store 1 bit of information within it. Hence, it makes cost per bit high and it also takes lot more space in the motherboard compared to DRAM. Looking at its complex circuitry , it is quite obvious that it is costly. Static ram can store data statically for a longer period of time so it need not refresh the data regularly as in the DRAM. Generally speaking, it can retain data as long as power is supplied to it.
What is Dynamic RAM
Dynamic RAM is slower compared to staic ram and it is used in computers main memory. It needs only 1 transitor and capacitor to keep one bit of data within it. So, its cirucit is quite simple which makes it cheaper than SRAM. It also takes less amount of space in motherboard. Dynamic RAM leaks data in a much faster rate than SRAM so, it need to be refreshed regularly to retain its data. Since it is regularly refreshed it is termed as Dynamic random access memory.
Why DRAM is chosen over SRAM for making main memory of computer
SRAM is faster which makes it suitable candidate for making primary memory but the heavy space requirement and high price makes it unsuitable for choosing as main memory. That is why, DRAM is chosen over SRAM. One more point is, seeing the high speed of SARM, manufacturers have chosen it for making cache memory. Because cache memory is small in size, using SRAM for cache will not take much space in the motherbord and this strategy doesn't shoot up the overall price of a computer.
So, to make an computer efficient and price in budget, we use DRAM for main memory and and SRAM for cache memory.
BN Computer Academy
All Rights Reserved