Virtual memory - if process' virtual memory is larger than real physical memory, why isn't there an issue with process overwriting other memory?

StackOverflow https://stackoverflow.com/questions/22513199

Let's say we have a process with 1.5 GB of virtual memory on a machine with 1GB physical memory. Now the process behaves as it has more memory than it really has, and may write >1GB to memory. (at least, this is how i've understood it)

But how is this not a problem? As an analogy, if I have €1 and want an ice cream costing €2, I can pretend I have €2 until I'm at the counter, but when I actually have to deliver, I am going to embarass myself when I try giving the same coin twice.

Please help me understand

有帮助吗?

解决方案

  1. The process may have allocated the memory (= requested the pages) but not yet accessed them.

  2. Typically, virtual memory is combined with swap, so the OS will move unused pages to disk when it runs out.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top