TODO revision 1.10
1$NetBSD: TODO,v 1.10 2007/08/23 19:21:40 ad Exp $ 2 3Bugs to fix: 4 5- Add locking to ld.elf_so so that multiple threads doing lazy binding 6 doesn't trash things. 7 8Interfaces/features to implement: 9 10- Priority scheduling. 11 12- Priority inheritance. 13 14- Figure out whether/how to use registers reserved in the ABI for 15 thread-specific-data to implement pthread_self(). 16 17- Figure out what to do with changing stack sizes. 18 19- A race between pthread_exit() and pthread_create() for detached LWPs, 20 where the stack (and pthread structure) could be reclaimed before the 21 thread has a chance to call _lwp_exit(), is currently prevented by 22 checking the return of _lwp_kill(target, 0). It could be done more 23 efficiently. (See shared page item.) 24 25- Adaptive mutexes and spinlocks (see shared page item). 26 27- Have a shared page that: 28 29 o Allows an LWP to request it not be preempted by the kernel. This would 30 be used over critical sections like pthread_cond_wait(), where we can 31 acquire a bunch of spin locks: being preempted while holding them would 32 suck. _lwp_park() would reset the flag once in kernel mode, and there 33 would need to be an equivalent way to do this from user mode. The user 34 path would probably need to notice deferred preemption and call 35 sched_yield() on exit from the critical section. 36 37 o Perhaps has some kind of hint mechanism that gives us a clue about 38 whether an LWP is currently running on another CPU. This could be used 39 for adaptive locks, but would need to be cheap to do in-kernel. 40 41 o Perhaps has a flag value that's reset when a detached LWP is into the 42 kernel and lwp_exit1(), meaning that its stack can be reclaimed. Again, 43 may or may not be worth it. 44 45- Keep a pool of dead LWPs so that we do not have take the full hit of 46 _lwp_create() every time pthread_create() is called. 47 48- Need to give consideration to the order in which threads enter and exit 49 synchronisation objects, both in the pthread library and in the kernel. 50 Commonly locks are acquired/released in order (a, b, c -> c, b, a). 51