Skip to content

Mv spin locks

Matthew Von-Maszewski edited this page Aug 22, 2013 · 6 revisions

Status

  • development started August 21, 2013

History / Context

For performance discussions, it is best to assume Erlang's schedulers run continuous busy wait loops. The continuing thought is that performance is lost anytime leveldb gives up a its time slice to a spinning Erlang scheduler. This branch begins the conversion of tight threading synchronization points from pthread_mutex_t to pthread_spinlock_t. pthread_spinlock_t keeps the time slice with the current thread instead of going to sleep and causing a longer spin within Erlang.

Not all platforms support pthread_spinlock_t. Google established good rules for platform specific implementation. The Spin and SpinLock classes build upon the Google code. Where pthread_spinlock_t is not available, the new Spin and SpinLock classes default to using the established Mutex class under the covers. Example: Mac OSX does not support pthread_spinlock_t and therefore continues to use pthread_mutex_t.

Implementation

Clone this wiki locally