converted to 1.6 markup
|No differences found!|
I think that demand paging it's an interesting topic, so I will try to write some ideas.
It's a dynamic memory allocation technique that consist of deferring page frame allocation until the last possible moment, for example, when a process attemps to access a page that is not present in RAM.
Different areas where demand paging apply
- Demand paging on executable files: When you execute a program, only a portion of it is loaded into memory. If the procesor attemps to execute code that is not in memory a page fault is generated and the affected page is loaded from the executable file. On memory pressure, the pages are freed without disk swapout.
- Demand paging of regular files: This apply only to mmap()ed files. Only the active pages of a file are resident on memory. On memory pressure, modified pages will be written in the file (MAP_SHARED) or in the swap area (MAP_PRIVATE).
- Demand paging on the heap: The kernel defer the allocation after a brk() system call and do it when the process try to access to that pages. On memory pressure, the pages are swapout to swap partition.