[ECOS] [PATCH] Optimized mutex operations

Luoqi Chen lchen@onetta.com
Mon Oct 22 15:18:00 GMT 2001


I've modified the current mutex implementation to take advantage of
atomic update
primitives provided in many processors, this should significantly
improve the
performance of operations on uncontested mutexi. The patch is available
at
http://www.freebsd.org/~luoqi/ecos .

I've also discovered a race in the current mutex implementation's
priority
inheritance code: during unlock, the first thread blocking on the sleep
queue
is waken and inherits the priority of the previous owner. There lies a
window
between unlock returns and the new owner-to-be gets a chance to run in
which
another thread blocking on the same mutex might inherit a even higher
priority,
and when the owner-to-be becomes the owner, it has a lower priority than
one
of the threads blocked.

-lq



More information about the Ecos-discuss mailing list