Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alternative solution for Problem #4: Using CAS Operation #2

Open
burnerlee opened this issue Sep 6, 2024 · 0 comments
Open

Alternative solution for Problem #4: Using CAS Operation #2

burnerlee opened this issue Sep 6, 2024 · 0 comments

Comments

@burnerlee
Copy link

burnerlee commented Sep 6, 2024

Just checking in, did you try solving the problem 4 using a single global key? (using cas).

Tried that and couldn't wrap my head around the issue. Eventually, I learned that CAS doesn't introduce linearisation to the state of the store. If you too missed on this, you can check out these threads, they have done a really good discussion about the problem.

https://community.fly.io/t/sequential-consistency-in-challenge-4-grow-only-counter/10965

jepsen-io/maelstrom#39

Finally, figured out a solution, though the random number write before the read seems a bit hacky. Let me know what you think.
https://github.com/burnerlee/gossip-gloomers/blob/0ef96ce056944b0e04f02c6abcf93dcbddfac8db/maelstrom-counter/main.go

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant