Log In
Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
Welcome to GATE CSE Doubts, where you can ask questions and receive answers from other members of the community.
0 votes

I have been studying the virtual memory concept in Operating Systems. I understand that : 

  1. Each process is given its own virtual address space – which might be very larger than the physical address space – to execute. 
  2. If the processes cannot accommodate its pages in the main memory, we can use secondary memory for swapping and storing the pages. 

I recently came across this question – PYQ 1995 in which, it is said that Virtual memory is limited by secondary memory. But I could not understand why?


For example, I am using 64 bits OS, so I can address $2^{64}$ address locations (i.e., virtual address space associated with each process is $2^{64}$), but obviously my secondary memory is not $2^{64}$ bytes. 


What am I missing?

in Operating System 5 points 33 views
main memory means RAM

Secondary memory means HARD DISK.

When a process in execution, required more memory than RAM, then it can use Hard disk, by swaping process - this is called virtual memory concept. If process is required more than HARD DISK then where to store it ? That's why " virtual memory linited by secondary memory"
@Shaik Masthan Ji, Yes I understand that. But why the amount of Virtual address space of a process is limited by secondary memory?

Shouldn’t it be like, the total amount of virtual memory that can be collectively used by all the processes – is limited by secondary memory?

Consider the same example mentioned in the question, there each process is allocated $2^{64} bytes$ of Virtual address space (assuming the memory is byte addressable). I understand that the total virtual memory that is collectively used by all processes, must be lesser than secondary memory.

But the Virtual address space – $2^{64} bytes$ – that is allocated to each process is not lesser than the secondary memory, so it is not limited by secondary memory, right?

Correct me if I am wrong.
if you have 500 rupees in hand, and there are 5 persons to distribute.

Then we can say, total amount restricted by 500.

and one person can not get more than 500.


i hope you relate it.

1 Answer

0 votes


For a short answer, I can say there is the physical address space (usually a shared one, though in unusual configurations such as NUMA or if you consider the address space visible to e.g. the GPU you can have separate physical address spaces) which represents the actual RAM and also memory mapped I/O ranges for the various devices on your system.

Then there is the virtual address space, which is one layer above the physical one, and you have to do a form of translation (in hardware) from the virtual addresses to the physical addresses.

Pointers in a program hold virtual addresses; as such, pointers with the same value may point to different memory in different processes. Physical addresses are only visible to the operating system….

That translation allows for the OS to do various tricks (demand paging, swapping being the most common ones) which are seamless — barring performance/timing of events — to the process itself. So in short, every process has a separate address space in which its pointers work, and it’s a virtual address space as it’s not representative of the actual physical address space, of actual RAM...






What is the difference between virtual address space and virtual memory?


Virtual Address Space is the collection/range of logical or virtual addresses for a particular process on a computer system. Just to give some insight into virtual addresses -- When the CPU executes our program's instructions, it needs to fetch the instruction, operands/data from main memory (DRAM). Similarly, it also writes the results back to main memory.

When CPU fetches/writes stuff from/to DRAM, it doesn't directly generate the actual physical address of the desired location in DRAM. CPU generates a logical or virtual address which undergoes translation through the joint work done by MMU (hardware) and OS code (software) to get the corresponding physical address.

Virtual Memory is a storage abstraction over DRAM and HDD that can allow the execution of software program whose effective usage/size is more than the size of physical memory. In other words, virtual memory is a technique that does not require the entire program to be present in main memory before the execution begins.

Virtual Memory technique actually uses main memory as a cache of program's pages with unused pages stored on disk blocks. Demand Paging is a way to implement virtual memory where the pages are loaded into memory off the disk as and when they are needed (as a consequence of page faults).

The concept of logical or virtual address space exists whether or not the system implements virtual memory. CPU will still generate virtual addresses that will be translate to corresponding physical addresses, but the entire program needs to be main memory (aka DRAM aka physical memory) if the system doesn't implement virtual memory....

633 points

@asqwer Thanks for the answer. So we can say that size of virtual memory is limited by secondary memory because we need space in secondary memory for swapping. Link

Let's say, I have 4GB RAM and 1TB HDD, so the total size of the memory used by all the programs can be greater than 4GB, but it is limited by 1TB HDD. I understand so far. 

Why does the address space that is allocated to each program is limited by the secondary memory? With the same system specifications as mentioned above, I can have Virtual address space as (say) $2^{64} or ^{48} bytes$. (Obviously, no program is going to use the entire virtual memory address space allocated to it.)

The limitation should be, the size of memory that is being used by the program(s) should not exceed the secondary memory size (so that we won’t run out of space for swapping). Why is the virtual address space allocated to each program is limited by secondary memory? 1995 PYQ



Changing address translation tables means changing the size of segments or length of that segment in table .

This address translation table contains the base address and length of the segment. so changing length of the segment is performed by the operating system when switching context from process A to process B....