Slide 8
Slide 8 text
Simulating fork() on Windows
Enough to make PostgreSQL work if you’re lucky
• The only way to create a child process is
CreateProcess(), which shares selected handles
but not memory with the child
• The contents of the important global variables
have to be restored by hand, libraries initialize
themselves from scratch, etc…
• The addresses of private mappings may be
di
ff
erent, but we don’t care about those
• The main shared memory region must be at the
same address in all backends, so we jump
through a number of hoops, even retrying
• Reported to add ~40ms to parallel queries with
tiny memory map, probably much more
depending on con
fi
gured libraries and page count
foo.exe
foo.exe
foo.dll
foo.dll
heap
heap
shmem shmem
3 →
fi
le 3 →
fi
le
1