Trapping sigsegv is a great way to do memory management.
void sa(int _,siginfo_t*s,void*__){
mmap((void*)((~PAGESZ-1)&(uintptr_t)s->si_addr),PAGESZ,
PROT_READ|PROT_WRITE,MAP_FIXED|MAP_ANONYMOUS,-1,0);
}
Want automatic logging of a big on-disk data structure? mmap some pages read-only map_private, trapping writes and logging the address (then remapping the page read+write). Then at "save time", write out page contents to a replay log, fsync+fdatasync+fcntl-F_FULLFSYNC, then rewrite the file using pwrite/write.You can also implement big sparse hashmaps this way: Every time a server gets a request, it allocates a cell and tells the client about it. Those cells are read+write. If a cell gets checked in, the server simply decrements the counter, but if there's a page fault (read-only) the server can then take the slower path of finding the server that actually responds to it.
And so on.