in reply to Re^3: Thread sharing a bit vector??
in thread Thread sharing a bit vector??
The difference is "shared," not "threading."
With the (slight; and possibly implied) modification of s/"shared"/threads::shared/, we agree.
Though I disagree with "any sort of locking requirement would knock that advantage almost completely out".
Mutual exclusion to prevent concurrent access can be achieved far more cheaply than it is currently implemented in Perl. Sufficiently cheaply in the no-contention case, to allow locking to be almost costless for low-but-not-zero contention algorithms.
Indeed, in my experiments with lock-free and wait-free algorithms, I've found that "locking" algorithms can be more efficient than either, for many applications, where: a) the no-contention branch avoids dips into the kernel; b) the contend branch spins a little before deciding it needs to wait (and therefore dips into hte kernel).
Of course, that doesn't work so well for long-term locks, but that is an architectural problem rather than a fundamental algorithmic one.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^5: Thread sharing a bit vector??
by traceyfreitas (Sexton) on Apr 13, 2012 at 01:04 UTC | |
by BrowserUk (Patriarch) on Apr 13, 2012 at 01:41 UTC | |
by traceyfreitas (Sexton) on Apr 13, 2012 at 11:00 UTC |