> everything easier. I don't really see futex creation/destroy
> as an high
> frequency event that might be suitable for optimization.
> Usually you have
> your own set of resources to be "protected" and in 95% of
> cases you know
> those resources from the beginning.
If with inititialization you mean taking the slow path ...
... then that depends. If you have futexes with an small contention rate,
you will be initializing and destroying futexes over and over again all the
time [eg: futex is unlocked, somebody acquires it [no init], then somebody
acquires it [init], then two releases in a row, then same thing, over and
over]. I have seen that behaviour, and that is specially true when you go up
to a lot of threads.
In fact, this is one of the main killers for the priority based futex
implementation I am trying to figure out ... I allocate a _big_ array the
first time I take the slow path for a futex - and that is ugly when you go
up to many futexes that have a low contention rate. I need to devise some
kind of smart caching or some way to take care of that case.
Inaky Perez-Gonzalez -- Not speaking for Intel - opinions are my own [or my