Skip to contentSkip to conversation

futex API docs?

DISCUSSION Francesc Oller 1 participant 1 message Oct 8, 2002

lore
Share & tools
lore
#0 lore raw

Hi all!

I've been trying to understand how futexes work looking at the last dev. kernel. I've not found any docs. Are there any?

Basically:

P (fast P sem op):

  if (atomic_decrement(sem)<0)
    sys_futex(..,FUTEX_WAIT,....);

V (fast V sem op):

  if (atomic_increment(sem)<=0)
    sys_futex(..,FUTEX_WAKE,....);

Futexes need be counting semaphores since there could be WAKEs in the middle of atomic_decrements and WAITs (not atomic) but I do not see this in the code. I can't find the kernel counter in the sources

Can anybody help me?

Many thanks in advance

Please CC to my e-mail since I'm not subscribed.

Cheers

Francesc