class Latch

cheap limited deadlock- & starvation-free interthread spinlock mutex More...

Definition#include <qvmm.h>
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Members


Detailed Description

cheap limited deadlock- & starvation-free interthread spinlock mutex

Latches provide simple mutual exclusion between forks. Each fork may hold at most one Latch at a time. Page allocation uses this latch, so it must be free or the allocation will fail.

Use Latches only for very short term locking.

The goal is to let as many forks as possible access concurrently the database so that while one fork page faults, the others can continue using the cpu. To avoid excessive serialization, we must reduce to a minimum the amount of global locking required.

Latches are meant to be very cheap (but limited) mutex.

It avoids global locking by not using a wait queue. Instead, a global hash table is used as rendez-vous point for latch requests and forks wait by yielding and looping.

The latching algorithm garantees deadlock and starvation freeness.

void lock ( void* target)
[static]

lock a latch

Parameters:
targetaddress to lock

void unlock ( void* target)
[static]

unlock a latch

Parameters:
targetlocked address