[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: #15646 BerkeleyDB hybrid mutexes



Keith Bostic wrote:
On Oct 9, 2007, at 12:02 AM, Howard Chu wrote:

With a CPU-hog running in the background, the test with BDB 4.2.52
takes only 37 seconds, while BDB 4.6.21 takes 1:42. Watching with
top you can see that BDB 4.6.21 gets a lot less CPU than BDB
4.2.52. This is the problem with using yield() on an NPTL system -
whereas on most POSIX systems yield() only yields control to some
other thread in the current process, on NPTL yield() gives up the
CPU for the entire process.

Is there a call that would be preferable on NPTL?

What call on NPTL will only yield control from the thread, not the
entire process?

When we first encountered this problem in the OpenLDAP source we used select() with a zero timeout. But I recall that that performed poorly as well, and nowadays we just avoid doing any type of yield at all. I think the real answer here is that on Linux 2.6 you really just want to use the native mutex (pthread, futex, whatever it's called) and not do anything else.


--
  -- Howard Chu
  Chief Architect, Symas Corp.  http://www.symas.com
  Director, Highland Sun        http://highlandsun.com/hyc/
  Chief Architect, OpenLDAP     http://www.openldap.org/project/