Saturday, February 24, 2007

Computer Memory - RAM, ROM, Cache, Virtual Memory

Random Access Memory (RAM) and Read Only Memory (ROM) are essential computer memory. Virtual Memory and Cache are other terms we often hear related to computer memory.

What is RAM?

As the name suggests, Random Access Memory can find and access the data randomly. Sequential access is the opposite of Random access. In Sequential access, to retrieve the data that is stored in the middle, all the data from the beginning has to be read sequentially until the searched data is found. So it takes time. Where as in RAM, the data can be directly jumped to the middle if necessary without having to read the data sequentially. So the reading is faster. In computers and printers RAM is used. In fact, RAM is the most important memory in computers and printers.

Types of RAM.

Dynamic RAM and Static RAM (SRAM) or two types of RAM. Of these, Dynamic RAM is cheaper and commonly used. Static RAM is very fast. A dynamic RAM has to be refreshed many thousand times in a second. Static RAM does not have to be refreshed.

RAM is a volatile memory. Hence, when there is a power cut, all the data in the RAM memory is lost. RAM is always referred to as the Main Memory. RAM is a READ / WRITE Memory.

All the programs and data that we use in computers have to be first transfered to RAM from hard disk before it can be used. Therefore the higher the RAM size the faster is your computer.

What is ROM - Read Only Memory

ROM also uses Random Access method to read data. The only difference is that the data written to a ROM memory can only be read. You can write to it.

Since RAM is volatile, the data is erased when the computer shuts down or power is cut, but ROM is non volatile. Therefore the data in ROM is always there even when there is no power.

All the computers have a ROM. The most essential programs that are required to start the computer are stored in this ROM memory.

Calculators, Laser Printers use ROM.

PROM - Programmable Read Only Memory - is a part of ROM memory. When manufactured the PROM is empty. Then data is written to it using a special device.

EPROM - Erasable Programmable Read Only Memory - is a type of ROM that can be erased using Ultra Violet rays and then re prorammed with different data or programs.

EEPROM - Electrically Erasable Programmable Read Only Memory - is a type of ROM that can be erased by using current.

What is Virtual Memory?

A part of the hard disk can be used as a Virtual Memory. Generally the size of the virtual memory in a computer is 2 or 2.5 times greater than the RAM memory size in that computer.

Assume you are starting an application. But there are already many programs started previously that is occupying the RAM space. And the remaining space in RAM is not sufficient to use the new application that you are starting. Then the virtual memory is used. Now the Operating System comes into play. It decides which are the applications that are not currently used and then moves them from the RAM memory to the Virtual memory in Hard Disk. Therefore the RAM is now free and the new application can occupy the space and be started.

If the program that is moved to the virtual memory is used again then the Operating System brings that application back from virtual memory to the RAM and some other idle application is moved to the virtual memory.

Therefore the virtual memory is also referred to as Swap memory.

What is Cache ?

A part of the main memory (RAM) can be used as Cache or it can be separate chip.

The commands that are often used, or data often used will be kept in this static RAM. This static RAM is called Cache memory.

But there are also Cache memory that comes independently from RAM. Level 1 (L1) and Level 2 (L2) are types of cache memory. The cache integrated inside the microprocessor is categorised as L1 cache. For example Pentium Processor comes with 16KB cache. This is SRAM.

The cache between the Microprocessor and the RAM is L2 Cache. This is also SRAM category.

No comments: