mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-22 20:38:31 +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
13
libc/cosmo.h
13
libc/cosmo.h
|
@ -13,15 +13,24 @@ errno_t cosmo_once(_COSMO_ATOMIC(unsigned) *, void (*)(void)) libcesque;
|
|||
int systemvpe(const char *, char *const[], char *const[]) libcesque;
|
||||
char *GetProgramExecutableName(void) libcesque;
|
||||
void unleaf(void) libcesque;
|
||||
bool32 IsLinuxModern(void) libcesque;
|
||||
|
||||
int __demangle(char *, const char *, size_t) libcesque;
|
||||
int __is_mangled(const char *) libcesque;
|
||||
bool32 IsLinuxModern(void) libcesque;
|
||||
int LoadZipArgs(int *, char ***) libcesque;
|
||||
|
||||
int cosmo_args(const char *, char ***) libcesque;
|
||||
int LoadZipArgs(int *, char ***) libcesque;
|
||||
|
||||
int cosmo_futex_wake(_COSMO_ATOMIC(int) *, int, char);
|
||||
int cosmo_futex_wait(_COSMO_ATOMIC(int) *, int, char, int,
|
||||
const struct timespec *);
|
||||
|
||||
errno_t cosmo_stack_alloc(size_t *, size_t *, void **) libcesque;
|
||||
errno_t cosmo_stack_free(void *, size_t, size_t) libcesque;
|
||||
void cosmo_stack_clear(void) libcesque;
|
||||
void cosmo_stack_setmaxstacks(int) libcesque;
|
||||
int cosmo_stack_getmaxstacks(void) libcesque;
|
||||
|
||||
int __deadlock_check(void *, int) libcesque;
|
||||
int __deadlock_tracked(void *) libcesque;
|
||||
void __deadlock_record(void *, int) libcesque;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue