cvs commit: src/sys/ddb db_ps.c src/sys/kern init_main.c kern_exit.c kern_fork.c kern_resource.c kern_sig.c sys_generic.c src/sys/platform/pc32/i386 pmap.c src/sys/platform/vkernel/platform pmap.c src/sys/sys proc.h tree.h src/sys/vm vm_vmspace.c

Matthew Dillon dillon at
Thu Aug 16 15:49:51 PDT 2007

:So I was wondering if we even have to try to avoid reuse of tids.  I don't think so, because they are not user visible.  So why don't we just use a simple array to store the pointers?  Granted, that's going to waste memory if you first spawn 100000 threads and then close all but one.  But apart from that, it would be O(1) and *very* easy to use/understand.  Tid allocation and thread creation could even be lock-free (two atomic instructions, though, so maybe no gain).
:If we need to try to avoid reusing tids (like we should for pids), there is this cool O(1) pid allocator from NetBSD, using some fancy array with special data handling.
:  simon

    I'm a bit confused.  TIDs are (and have to be) user visible.  After all,
    how else do you signal a LWP?


More information about the Commits mailing list