libc_r is deprecated
Robert Watson
rwatson at FreeBSD.org
Thu Oct 27 03:31:11 PDT 2005
On Thu, 27 Oct 2005, David Xu wrote:
> You sample program is nothing to do with libpthread or libthr, you never
> have userland locking code, in kernel they should be same, in fact. I
> have done a simple test, on my dual PIII machine, libthr is faster than
> libpthread, if I use ULE, libpthread is far behind than libthr, I
> recommend you to try different file sizes, I have got very different
> result, for small file size, e.g /usr/src/sys/sys/umtx.h, libthr beats
> libpthread, I can not test big file, because my 100M network is very
> easy to be saturated.
>
> If you suspect fd locking overhead, try to use fork() model, though it
> will introduce more context switch overhead, but it still worthy to do.
Well, I think the significant difference is the scheduling of when work is
requested: specifically, that libthr with our current scheduler
necessarily results with a process competing more with itself for locks
associated with the process than libpthread, which tries not to run
additional threads unless there's a gap in current execution by a current
thread. The question, I suppose, is whether the answer to this problem
lies in:
- Helping the scheduler do a better job of discouraging that scenario.
- Working to change the file descriptor model to reduce the
impact of contention.
- Accepting that it's inevitable in the threading model and looking for
other things to improve.
I would like to run the following additional tests:
- Create a forked httpd microbenchmark to see what impact that has. I
suspect a performance improvement.
- Experiment with reducing contention on the file descriptor lock through
hacking a bit on how file descriptor arrays work -- nothing
production-worthy, but something that changes the potential contention
enough to see if it helps. I.e., break the array into two parts locked
using different locks.
- Use ktrace, mutex profiling, or pmc to try and evaluate whether
contention on the lock really is the cause. Alternatively, to roughly
attempt to profile wait times for that lock.
Robert N M Watson
More information about the freebsd-arch
mailing list