The size of the virtual storage is limited by the addressing scheme of the computer system and the amount of available additional memory, and not by the actual number of main storage locations.
The book apparently assumes (incorrectly) that you will not allocate virtual memory that you do not plan to use. Thus, he warns that the physical memory and hard disk used for exchange limit the virtual memory used (of course, from the point of view of your process, as well as other requirements for this resource pool - the OS and other processes).
In practice, it is often useful to allocate more virtual memory than you could use, because you might want to, for example:
- use virtual memory for a sparse array, where you directly point to a few scattered addresses,
- Page crash error when system resources fail, which complicates your code by trying to track available memory (remember that this is a dynamic process with other processes, etc.) or a pessimistic limit, which means that you cannot aggressively use your system capabilities
- let each program take advantage of the assumption that it was downloaded at the address for which it was compiled, so it can use an absolute address for jump instructions, etc., and not relative
Referring to your specific questions:
1. [virtual memory is also limited by the size of additional memory] How?
Again, it is limited in the sense that attempts to use will no longer be possible if the memory - both physical and swap - is exhausted.
2.Is changing (between main memory and secondary memory) a necessary condition for virtual memory?
It's a bit foggy ... virtual memory can only increase the total amount of memory processes that it can transparently use by swapping the contents of physical memory to make room for new memory needs, as well as for reloading the downloaded contents from secondary memory. But even if there is no disk space with a replacement (and, therefore, without swapping), or you do not have enough memory to perform any replacement, processes can still benefit from virtual addressing in accordance with sparse arrays, huge stack / heap areas with room for growth upon request, etc.
I mean, if the replacement is not allowed, we can still call it virtual memory, although the benefits will be limited?
May be. You can still use virtual addressing, but it depends on what terminology you accept, whether it classifies it as virtual memory: there is a reasonable argument in favor of the fact that βvirtual memoryβ means that you pretend to have more physical memory , so without a swap you wonβt want, t, even if you can use a virtual addressing component that supports virtual memory.