Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

In a sense it does. Page tables would need to be copied.


Yes, but they all point to the same pages. The tables take up a small fraction of the memory of the pages themselves.


But large fraction, if all you do afterwards is an exec call. Given 8 bytes per page table entry and 4k pages, it's 1/512 memory wasted. So if your process uses 8GB, it's 16MB. Still takes noticeable time if you spawn often.


I've never had the page tables be the cause of out of memory issues. Besides the fact that they are usually pre-allocated to avoid recursive page faults, but nothing would stop you from making the page tables themselves also copy-on-write during a fork.


Aren't page tables nested? I don't know if any OS or hardware architecture actually supports it, but I could imagine the parent-level page table being virtual and copy-on-write itself.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: