Closed Bug 1134974 Opened 9 years ago Closed 8 years ago

Global futex lock is likely to be contended

Categories

(Core :: JavaScript Engine, defect)

defect
Not set
normal

Tracking

()

RESOLVED DUPLICATE of bug 1268793

People

(Reporter: lth, Unassigned)

References

(Blocks 1 open bug)

Details

We should not touch this bug until there's evidence of a problem, but the global lock that controls the futex data structures could be a performance bottleneck: suppose two threads are communicating through location L and two others are communicating through location M.  All four will contend for access to the same futex lock, even though the two pairs are independent.

It is probable that we could instead have one lock per location that futexes are waiting on; wait/wake fairness is only per-location, so this should not affect semantics.

If we just blindly allocate one lock per location we wait on then we'll end up in the same lock GC problem we were trying to avoid by going with the futex API in the first place.  So something cleverer is needed.
I'm guessing you intended to block another bug :)
Blocks: shared-array-buffer
No longer blocks: 105
There's a long discussion about the problem here: https://github.com/tc39/ecmascript_sharedmem/issues/12, where a concurrent hash table (presumably hashing by address of the word) is advocated.

A completely different take on it is a patch on 1248670, which attempts to speed up futexes by emulating some synchronic facility under the hood; that is probably misguided (and it breaks some guarantees) but may still be interesting to consult.
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.