Question about rtld-elf. Anyone?.. Anyone?

Narvi narvi at haldjas.folklore.ee
Tue Apr 29 06:10:40 PDT 2003


[snip]

> ...
> This is a short-term fix for a larger problem.  The use of spinlocking
> isn't guaranteed to work in all cases.  For example, if the spinning
> thread has higher priority than all other threads, it may never be
> pre-empted, and the thread holding the lock may never progress far
> enough to release the lock.  On the other hand, spinlocking is the
> only locking that can work with an arbitrary unknown threads package.
>
> I have some ideas for a much better fix in the longer term.  It
> would eliminate all locking inside the dynamic linker by making it
> safe for symbol lookups and lazy binding to proceed in parallel
> with a call to dlopen or dlclose.  This means that the only mutual
> exclusion needed would be to prevent multiple simultaneous calls
> to dlopen and/or dlclose.  That mutual exclusion could be put into
> the native pthreads library.  Applications using foreign threads
> packages would have to make their own arrangements to ensure that
> they did not have multiple threads in dlopen and/or dlclose -- a
> reasonable requirement in my opinion.
> ====
>
> Basically he's describing the exact scenario you're concerned about.  The
> last paragraph suggests a better way.
>

You will then need to make sure something sensible (and not a deadlock)
happens if fork() gets called at a time when dlopen() / dlclose() is
running in another thread.

> Cheers,
> -Peter
> --
> Peter Wemm - peter at wemm.org; peter at FreeBSD.org; peter at yahoo-inc.com
> "All of this is for nothing if we don't go to the stars" - JMS/B5
>



More information about the freebsd-threads mailing list