Giter Site home page Giter Site logo

Comments (5)

aswaterman avatar aswaterman commented on September 23, 2024

(Just providing context:) glibc's low-level locking code seems to use CAS to acquire locks and swap to release them.

from riscv-isa-manual.

aswaterman avatar aswaterman commented on September 23, 2024

I think all there is to say in the spec is that some more complex locks will be implemented with LR/SC. The only interesting thing about those sequences is how to set the AQ/RL bits on the two operations; while I think it will suffice to set AQ on a lock-acquiring SC and RL on a lock-releasing SC, we'd rather wait til the memory model discussion is more complete before writing that up.

from riscv-isa-manual.

arkflpc avatar arkflpc commented on September 23, 2024

I think that lock elision isn't compatible with LR/SC mechanism. Elided store wouldn't invalidate reservations held by other harts after LC instruction and SC would succeed. It would made LR/SC suffer from ABA problem.

from riscv-isa-manual.

sorear avatar sorear commented on September 23, 2024

There are a lot of misconceptions about ABA problem. LR/SC only has an expressiveness advantage over CAS if unrelated memory accesses are allowed to occur between the LR and the SC; RISC-V forbids this so RISC-V LR/SC is already precisely equivalent to CAS..

from riscv-isa-manual.

kasanovic avatar kasanovic commented on September 23, 2024

Regarding ABA - in the case where there is a single word being accessed, then LR/SC will abort if a second hart rewrites the same value as is currently in memory to the single word under reservation by a first hart. CAS will not detect this. This is admittedly a limited case but does mean LR/SC is not equivalent to CAS for ABA.

from riscv-isa-manual.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.