TODO revision 1.10
11.10Sad$NetBSD: TODO,v 1.10 2007/08/23 19:21:40 ad Exp $
21.5Sad
31.8SadBugs to fix:
41.2Sthorpej
51.2Sthorpej- Add locking to ld.elf_so so that multiple threads doing lazy binding
61.10Sad  doesn't trash things.
71.2Sthorpej
81.8SadInterfaces/features to implement:
91.2Sthorpej
101.10Sad- Priority scheduling.
111.8Sad
121.10Sad- Priority inheritance.
131.8Sad
141.10Sad- Figure out whether/how to use registers reserved in the ABI for
151.10Sad  thread-specific-data to implement pthread_self().
161.8Sad
171.4Schristos- Figure out what to do with changing stack sizes.
181.5Sad
191.6Syamt- A race between pthread_exit() and pthread_create() for detached LWPs,
201.6Syamt  where the stack (and pthread structure) could be reclaimed before the
211.6Syamt  thread has a chance to call _lwp_exit(), is currently prevented by
221.6Syamt  checking the return of _lwp_kill(target, 0).  It could be done more
231.6Syamt  efficiently.  (See shared page item.)
241.5Sad
251.9Sad- Adaptive mutexes and spinlocks (see shared page item).
261.5Sad
271.5Sad- Have a shared page that:
281.5Sad
291.5Sad  o Allows an LWP to request it not be preempted by the kernel. This would
301.5Sad    be used over critical sections like pthread_cond_wait(), where we can
311.5Sad    acquire a bunch of spin locks: being preempted while holding them would
321.5Sad    suck. _lwp_park() would reset the flag once in kernel mode, and there
331.5Sad    would need to be an equivalent way to do this from user mode. The user
341.5Sad    path would probably need to notice deferred preemption and call
351.5Sad    sched_yield() on exit from the critical section.
361.5Sad
371.5Sad  o Perhaps has some kind of hint mechanism that gives us a clue about
381.5Sad    whether an LWP is currently running on another CPU. This could be used
391.5Sad    for adaptive locks, but would need to be cheap to do in-kernel.
401.5Sad
411.5Sad  o Perhaps has a flag value that's reset when a detached LWP is into the
421.5Sad    kernel and lwp_exit1(), meaning that its stack can be reclaimed. Again,
431.5Sad    may or may not be worth it.
441.5Sad
451.5Sad- Keep a pool of dead LWPs so that we do not have take the full hit of
461.10Sad  _lwp_create() every time pthread_create() is called.
471.5Sad
481.5Sad- Need to give consideration to the order in which threads enter and exit
491.5Sad  synchronisation objects, both in the pthread library and in the kernel.
501.8Sad  Commonly locks are acquired/released in order (a, b, c -> c, b, a).
51