mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-10-05 06:01:03 +00:00
Make threads faster and more reliable
This change doubles the performance of thread spawning. That's thanks to our new stack manager, which allows us to avoid zeroing stacks. It gives us 15µs spawns rather than 30µs spawns on Linux. Also, pthread_exit() is faster now, since it doesn't need to acquire the pthread GIL. On NetBSD, that helps us avoid allocating too many semaphores. Even if that happens we're now able to survive semaphores running out and even memory running out, when allocating *NSYNC waiter objects. I found a lot more rare bugs in the POSIX threads runtime that could cause things to crash, if you've got dozens of threads all spawning and joining dozens of threads. I want cosmo to be world class production worthy for 2025 so happy holidays all
This commit is contained in:
parent
906bd06a5a
commit
624573207e
51 changed files with 1006 additions and 321 deletions
|
@ -25,7 +25,7 @@
|
|||
//
|
||||
// glibc fails this test
|
||||
// musl passes this test
|
||||
// cosmo only guarantees this in process shared mode
|
||||
// cosmo only guarantees this in process-shared non-debug mode
|
||||
|
||||
atomic_bool done;
|
||||
atomic_bool ready;
|
||||
|
@ -51,7 +51,14 @@ void* work(void* arg) {
|
|||
|
||||
int main() {
|
||||
|
||||
if (IsQemuUser()) {
|
||||
// qemu is believed to be the one at fault
|
||||
kprintf("mutex_async_signal_safety_test flakes on qemu\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (IsModeDbg()) {
|
||||
// the deadlock detector gets in the way of our glorious spin lock
|
||||
kprintf("mutex_async_signal_safety_test not feasible in debug mode\n");
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue