You must Sign In to post a response.
  • What is the main difference between the main memory, cache memory and virtual memory?

    Do you know the difference between the main memory, cache memory and virtual memory? Ask our technical experts for the right answer.

    We all have heard about main memory, cache memory and virtual memory in computer system. My question is, what is the main difference between the main memory, cache memory and virtual memory? Why do we need each one of them in case of computing system?

    Can anyone please help me by clearing the doubt?
  • Answers

    5 Answers found.
  • Main Memory: Main memory also is known as RAM stands for Random Access Memory. It is circuits that require continuous electrical power in order to maintain its information and if power will be lost then all information will be lost. It is expensive than hard disk drive but faster than the hard disk. it within motherboard near CPU and look like a game chip.

    Cache Memory: Cache memory is within CPU, it works like a buffer in Computer system. It stores data in KB and recent activities that are done by CPU. it reduces the access time to fetch data from the main memory. CPU always first look for data in cache memory and if not present in the cache then get from the RAM. Cache is more expensive than RAM, stores small amount of data but it is very fast in the processing cycle.

    Virtual Memory: Virtual memory is a different thing than RAM and Cache. It is a feature of the operating system. In simple words, if your Computer's RAM is full and has no space to start a new task, in that main time CPU transfers data from RAM to Hard disk and creates some temporary virtual space in the RAM. Virtual memory is an inbuilt feature of OS or hardware, no cost for this Memory.

  • Here are answers to your question. Let me explain the terms in possible layman language instead of being technically correct on semantics and jargon.

    1. Main memory : On your BIOS main memory refers to the RAM. Also known as random access memory. These are the slots on your motherboard that requires modules to be inserted in order for BIOS to boot into any system. Both read and write queries are sent through the RAM. The purpose of this memory is to allocate the memory for hardware interaction and the operating systems I/O buffer. In the absence of hard disk, the RAM is often used as a buffer memory to boot into Live USB or Live CD/DVD discs. Linux live USB images makes use of main memory primarily to use the OS even in the absence of the HDD. Almost every operating system requires RAM in order for it to boot into desktop or command prompt. Also BIOS doesn't allow further I/O processing in absence of RAM.

    2. Cache Memory: This memory unit is typically built into motherboard and CPU. If you check the box of the CPU it refers to the specific cache memory from 256 onward for modern processors. Operating system like Linux and Unix also maintain their own set of cache memory during the boot for I/O requests. In case of motherboard it comes with fixed set of it's own cache memory. You can get the information about motherboards cache memory inside BIOS. The functionality of this memory is to make quicker read write requests than the RAM. Your operating system makes use of this memory for loading some I/O modules quicker to access.

    3. Virtual Memory: Virtual memory is the feature provided by the operating system to allow system to execute read write request in the shortage of main memory. Every operating system allocates specific portion of HDD for the virtual memory. Windows allocates around 100-400 MB space for virtual memory by default. In case of UNIX and Linux it allows specific portion of memory for virtual memory. In case of UNIX and Linux this memory is known as "Swap memory". This memory is part of software allocation and it is not physical memory module. So it is called as Virtual memory.

    Simple difference in between each memory unit can be explained as main memory is used by BIOS and CPU to communicate with the other devices inside operating system. Cache memory fills the gap of physical memory for quicker I/O requests. And virtual memory is used when the main memory and cache memory fall short for writing large number of I/O requests. It is upto the operating system to make use of each of the memory in order to operate it's desktop or the command line access for read write access to various devices.

  • Main memory
    Main memory is also referred to as RAM or Random Access Memory. This is the place which takes care of all your processing. The amount of RAM that can be installed on a system depends on the hardware and operating system. It stores the important components of the system. It is also the home for program data on which the computer is working right now.
    The data on RAM is not stable. It is lost when power supply goes off or the program using it is closed down.

    Cache Memory
    Cache Memory is the memory that resides between the CPU and RAM. The cache memory is faster than RAM. As we all know, whenever the computer performs a task, CPU accesses memory from RAM. The purpose of the cache memory is to reduce the time taken by CPU to access memory from RAM. The cache memory is actually faster than RAM. Thus the time taken to access memory from cache is much lesser than that taken to access memory from RAM.
    However, the cost of cache memory is much expensive when compared to RAM. That is the reason why devices have lesser Cache memory. The memory used in Cache memory is referred to as Static Random Access Memory or SRAM. When the CPU needs to access memory, it checks whether the concerned memory exists in the cache memory. It accesses it if it is available. Else, the required memory is taken from RAM and copied to Cache memory. The CPU can access memory only from Cache. The cache memory is managed by the hardware. It resides in the processor itself.
    Cache memory is located closer to the CPU as compared to RAM. The data or instructions that are frequently accessed are stored on Cache meory. It is much faster than RAM and hard drive.
    Virtual Memory
    Virtual Memory has no physical existence. It is just a concept used to explain extending the memory and responsiveness of your computer. Virtual Memory saves the inactive part of the content RAM to the disk. The memory is provided back to the RAM when the content is required. The virtual memory is managed by the operating system. The memory is part of hardware.
    The Virtual Memory refers to the memory that has been moved from RAM to hard drive. The term used to describe the concept of moving the memory to hard drive is termed as Paging out.

    Live....and Let Live!

  • The relationship between the main, cache and virtual memory in the Windows Operating Systems (OS) goes like this:

    The first difference lies in the size. The hierarchy of them goes from the smallest to the largest as below:
    RAM (Main memory)

    But to start with we need to start with RAM in terms of better understanding.
    Main Memory – The Main memory of a computing system is called RAM, the short form of Random Access Memory. It is the Physical memory which is installed in the computing system. This is the part of memory where most of the processing work is done. The maximum memory of the RAM depends on the combination of hardware and the version of the Operating System. The amount of RAM is firstly dependent on the hardware space and then again controlled by the OS.

    Cache memory
    This memory covers a good range of items.
    The Processors will have multiple cache memory types which are usually known as level 1, 2 or 3.
    A Processor can have all of these three types installed in it. all these types of cache memory are made to speed up the processor functionality.
    The Hard drives use the cache memory to speed up the data transfers. The Hard drive controllers too use the cache memory. The Network Cards utilize the cache memory for high output. These cards are generally found on few servers mostly for gaming purpose.

    Virtual memory
    The first difference between Virtual Memory and the two others is that, virtual is not like the physical RAM. The Virtual memory in a Windows Operating System is generally referring to a kind of memory that can be temporarily moved from the RAM to a hard drive or a flash memory device.
    The Virtual memory can have other features if used with a hyper-visor, like the one we get to see in Microsoft's Hyper-V or VMWare's ESX/ESXi which is also known as vSphere. In that case the hyper-visor will manage all the memory by virtualizing them and assigning them to virtual machines.
    There are systems or Operating Systems which can set the pools of physical memory setting them as virtual memory for specific types of tasks.

  • Main memory
    1. Main memory is nothing but RAM( Random Access Memory).
    2. It is a volatile memory.
    3. Speed:- Much faster than Hard disk. The time required to access data placed anywhere within RAM is same. Speed counted in Giga Byte per second.
    4. Size:- Much smaller than Hard disk. Example:- 64MB, ..., 128GB .
    5. Cost:- Higher than cost of Hard disk.

    Cache memory
    1. Cache memory is SRAM(Static Random Access Memory).
    2. In a typical processor it is volatile. On Hard drive they(cache) are non-volatile.
    3. Speed:- Much faster than RAM.
    4. Size:- Very small. Example:- 30MB.
    5. Cost:- Higher than cost of RAM.

    Virtual memory
    1. It is a conceptual memory, where some portion of Hard disk is used as if it were RAM(called swap).
    2. Swap is non-volatile.
    3. Speed:- Slower than RAM. Speed is counted in Mega Byte per second.
    4. Size:- Depends on size of Hard disk.
    5. Cost:- Cost free.

  • Sign In to post your comments