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