Why does DECR count as atomic but GET then SET does not?
DSA Lesson 4
Real lessons in the time it takes to finish a coffee — DSA, SQL, English, science and general knowledge, with streaks, lives and leagues that pull you back.
DSA · Lesson 4 · Code analysis
A flash sale drops stock by one. Which command keeps the decrement atomic?
Correct +40 XP
Every course is a run of short lessons. Finish one and the next opens. You can jump ahead — but only by passing a check first, so nothing gets skipped by accident.
Daily streaks, XP for every answer, and a weekly league of thirty learners. Finish in the top ten and you move up a tier — Bronze all the way to Diamond.
See the live leaderboardWeekly cohort preview
Ends in 3d 14h
| Rank | Player | XP | Change |
|---|---|---|---|
| Promotion zone Top 3 advance | |||
| 1 | Aarav | 2,480 | +180 |
| 2 | Mira | 2,310 | +95 |
| 3 | Dev | 2,140 | −40 |
| 4 | You | 1,980 | +120 |
| 5 | Nisha | 1,860 | +60 |
A wrong answer costs one of five lives. When they run out the lesson waits, and lives refill over the next hour — so you come back sharper instead of grinding through a topic you have stopped reading.
One life every 60 minutes, up to five. Practice never takes more than one.
The format changes with the question, so recall never feels like filling in a form. Ten ways to answer, one goal: still know it tomorrow.
Every lesson has a thread. Ask a question, read the explanation someone else already worked out, or leave the shortcut you wish you had found first.
Browse the communityWhy does DECR count as atomic but GET then SET does not?
DSA Lesson 4
GET then SET is two separate steps, so another client can write in between and its value is lost. DECR is a single read-modify-write, so nothing can interleave.
Thread preview
Sign in once. Lives, XP and the exact question you stopped on follow you between the browser and Android — and the web needs no install at all.
Same account, same lives, same place in the course.
Longer reads from the people writing the courses — roadmaps, worked examples, and the revision order that actually helps.
It takes four minutes. You will know whether this works for you.
Read the full post, then sign in free to like and reply.
Loading post…