3.2.2: "lock requires two atomic ops"
nick black <[email protected]>
| Newsgroups | org.kernel.vger.perfbook |
|---|---|
| Message-ID | <[email protected]> |
enjoying the updated edition! "The lock operation is more expensive than CAS because it requires two atomic operations on the lock data structure, one for acquisition and the other for release." this might be worth expanding upon. it's not immediately obvious to me why the unlock would need to be atomic. the rough 2x certainly jives with this explanation, and i intend to go look at some source, but i'd think it would be more: atomic update fence non-atomic update you've presumably got threads attempting to lock with a CAS looking for a sentinel representing unlocked, right? so if i update back to that sentinel in multiple steps, they're going to miss in media res, no? feel no obligation to respond, of course. --nick -- nick black -=- https://www.nick-black.com to make an apple pie from scratch, you need first invent a universe.
signature.asc
(application/pgp-signature, 833 B)
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEmi//dHmU4oe+xCLxX0NADCHL+swFAmSJBp8ACgkQX0NADCHL +syMDw/9G6OoM2yBZ9d5akKacfPs9j016L1TUW/WhmmFgMo+sP5CqPFcccEEwljM /x+klKks/Brl+E2s0H9jv/VAy+4pBbfnEuhjZyLqPWW4snYteqylXlTAwM5KOVjA plOoiwk06Sm+OwHMzCMYeTXi92tixYPUMlrw6DFOrNTDQecyl5uJ4JCP7nf3RBYa sYCDqfUpfo6WkQDgP57a+jKYUPyKnKWK9CQAhk2f8p1c+RcjxE8YX4LjMN3znGpC SYNIgOr9uqrEA2mwE1XNZKzJYVn0c1Snr+cO9AgqSubuyqDHuqtwP6zCQnhKipwP QqLfhNVnh3BY0nrFe2i08a0dFIVUhCTdVFlakf9AQCYsxBPtQTrrJMI6p+8ma2pU u0IKp3gVQ1XM+4iMsVnE81b5yt9wgGJuAGCB7D392vz0tA6DtqajvgRY07tXnNLh A4hZKO6sIvw64tWMf1QiltQWCpIdpvn/bh8eZOIndNiUXf9nr+BG+8Qrk/cOGJxH hVeeOXunqWOCqPMWjDo8tAqVhdDOyyH1uexB+Wlshgv8JftzkmZAp4fGa6pTH/RW OHWxkKVrBhWFWvF6xXZMHJcWPKrRN2PlIq/FjKVdGTWKhgCb7kfzPqPEvPiW/I02 dxlOYwAj+cdIrouN50OjdvXyzFdymD2b+f52Z9Fq9tWrUMS1XsM= =WFau -----END PGP SIGNATURE-----