> I don't walk the thread descriptors. I don't write into them. I move > entire double-linked lists with a dozen or so instructions. Regardless > of how many threads were active in the parent. However this would cause a lot of copy-on-write faults on thread stacks when other thread resume execution. How about adding a MAP_DONTCOPY flag to mmap, using it for the thread stacks and then adding yet another flag and pointer to the clone syscall, pointing to a userspace array of addresses and flags, allowing to specify whether vmas should be copied, ignored (or maybe shared, as a future extension) so that userspace could specify that the current thread stack should be copied anyway?