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

Except it’s not irreplaceable, at least on Linux. userfaultfd allows you to define custom page fault handling. With it, you can even do crazy things like “mmap” a remote resource by making HTTP range requests on a read fault.


You’re right. Irreplaceable was a stronger way of putting it than the original, I think, so that’s more my mistake than hers, and I think the contrast with userspace stands.

mmap sits at this lovely intersection between virtual memory and the disk, and it’s been around for a long time. By now there are other means of playing within that nice intersection, but mmap is the pop classic.


Is there anything like that on Windows?


Windows has vectored exception handlers, which are a bit like UNIX signal handlers but much more sanely designed. You can use that to redirect control flow when a page fault occurs, and you can check the faulting address in your handler to scope it to a particular region of memory.


Yes, it's how JITs like Java work. Though I don't specifically know what the Windows API is.


This has nothing to do with JITs. JITs just have a stub trampoline. Some garbage collectors do have page tracking though.




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

Search: