Re: sched_yield() makes OpenLDAP slow

From: Howard Chu
Date: Fri Aug 19 2005 - 18:11:52 EST


Nikita Danilov wrote:
Howard Chu <hyc@xxxxxxxxx> writes:
> concurrency. It is the nature of such a system to encounter
> deadlocks over the normal course of operations. When a deadlock is
> detected, some thread must be chosen (by one of a variety of
> algorithms) to abort its transaction, in order to allow other
> operations to proceed to completion. In this situation, the chosen
> thread must get control of the CPU long enough to clean itself up,

What prevents transaction monitor from using, say, condition
variables to "yield cpu"? That would have an additional advantage of
blocking thread precisely until specific event occurs, instead of
blocking for some vague indeterminate load and platform dependent
amount of time.

Condition variables offer no control over which thread is waken up. We're wandering into the design of the SleepyCat BerkeleyDB library here, and we don't exert any control over that either. BerkeleyDB doesn't appear to use pthread condition variables; it seems to construct its own synchronization mechanisms on top of mutexes (and yield calls). In this specific example, we use whatever BerkeleyDB provides and we're certainly not about to write our own transactional embedded database engine just for this.
--
-- Howard Chu
Chief Architect, Symas Corp. http://www.symas.com
Director, Highland Sun http://highlandsun.com/hyc
OpenLDAP Core Team http://www.openldap.org/project/

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/