mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-08-01 15:30:29 +00:00
Make fork() go 30% faster
This change makes fork() go nearly as fast as sys_fork() on UNIX. As for Windows this change shaves about 4-5ms off fork() + wait() latency. This is accomplished by using WriteProcessMemory() from the parent process to setup the address space of a suspended process; it is better than a pipe
This commit is contained in:
parent
98c5847727
commit
0b3c81dd4e
44 changed files with 769 additions and 649 deletions
3
third_party/nsync/common.c
vendored
3
third_party/nsync/common.c
vendored
|
@ -238,7 +238,8 @@ static bool free_waiters_populate (void) {
|
|||
// netbsd semaphores are file descriptors
|
||||
n = 1;
|
||||
} else {
|
||||
n = __pagesize / sizeof(waiter);
|
||||
// don't create too much fork() overhead
|
||||
n = 16;
|
||||
}
|
||||
waiter *waiters = mmap (0, n * sizeof(waiter),
|
||||
PROT_READ | PROT_WRITE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue