开发者

Is Virtual memory infinite?

开发者 https://www.devze.com 2023-03-17 18:00 出处:网络
I have been asked in an interview if virtual memory is infinite? I answered saying that it is 开发者_C百科not infinite. Then the interviewer asked the explanation and what I suggested was that in wind

I have been asked in an interview if virtual memory is infinite? I answered saying that it is 开发者_C百科not infinite. Then the interviewer asked the explanation and what I suggested was that in windows we do have a manual way to configure virtual memory to a certain limit.

I would like to know if Virtual memory is really Infinite?


First of all, forget the idea that virtual memory is limited by the size of pointers on your machine.

Virtual memory limits are not the same as addressing space. You can address more virtual memory than is available in your pointer-based address space using paging.

  • Virtual memory upper limits are set by the OS: for example, on 32-bit Windows the limit is 16TB, and on 64-bit Windows the limit is 256TB.
  • Virtual memory is also physically limited by the available disc space.

For an excellent overview, which addresses various misconceptions, see the following:

http://blogs.msdn.com/b/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx


If nothing else then virtual memory is going to be limited by the amount of disk space available, this sadly is far from infinite.


At the very least, the size of virtual memory is limited by the size of pointers on given platform (unless it has near/far pointers and non-flat memory model). For example, you cannot address more than about 2^32 (4GB) of memory using single 32-bit pointer.

In practice, the virtual memory must be backed up with something eventually -- like a pagefile on disk -- so the size of storage enforces a more practical limit.


You were right to say, no, it's not infinite. Addressable virtual memory is limited by architecture address space. For further info see virtual memory.


The size of virtual storage is limited by the addressing scheme of the computer system and by the amount of secondary memory available and not by actual number of main memory locations.

For example :- Even if you had 20 TB of secondary memory, it doesn't mean that virtual memory can be 20TB. It is restricted by your computer architecture.


Virtual memory is the summation of RAM and available hard disk space in most cases. As the summation is a countable number, it can't be infinity.

0

精彩评论

暂无评论...
验证码 换一张
取 消