简体   繁体   中英

Is COW the same as Demand paging?

I was reading:

While I totally understand what COW is, I don't get anything regarding Demand paging, how it's different thatn COW at all? I am seeing it as exact copy and implementation of COW with different name. Am I wrong?

They're not the same.

Demand paging is a paging mechanism where you (the OS) only load in the required page into memory(RAM) at the exact time it's needed (during a page fault). This is opposite to doing a lot of prefetching, where you load several pages of memory before they're needed in expectation that they will be used in the future.

COW is copy-on-write, a method for saving memory writes. For instance, when a process forks, why do a complete copy of the parent memory? It takes up extra time and space. Why not instead do copy on write, meaning you let the two processes share memory, mark the memory as read only, then only copy a page when one of the processes wants to write to that page.

Demand paging is a virtual memory strategy. COW is an optimization for sharing memory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM