in reply to Re^7: OT: Locking and syncing mechanisms available on *nix.
in thread OT: Locking and syncing mechanisms available on *nix.
Thanks, but the trouble with that is we now need 3 elements. The flag, the cond_var and the mutex.
And the only 'reason' for using the mutex appears to be to serialise access to the flag. But mutexes always require a user/kernel/user space transition which is horribly expensive, when the same job can be done on modern processors using memory barriers and atomic instructions.
For example, the ready flag state changes can be safely done entirely in user space using gcc's Atomic builtins.
But that still doesn't allow us to ditch the mutex, because the only signalled wait construct is the cond_wait, which requires a bloody mutex.
Many of the issues, and solution to them, are discussed in Mutex .v. futex. What I've yet been unable to find is the documentation (and discussion of availablity) of futexes?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: OT: Locking and syncing mechanisms available on *nix.
by educated_foo (Vicar) on Mar 27, 2011 at 16:30 UTC | |
by BrowserUk (Patriarch) on Mar 27, 2011 at 17:59 UTC | |
by educated_foo (Vicar) on Mar 27, 2011 at 21:29 UTC | |
by BrowserUk (Patriarch) on Mar 27, 2011 at 21:40 UTC |