The `lock cmpxchg` instruction you use here is the literal foundation of glibc's pthread_mutex_t fast path and every lock-free data structure in Java's `java.util.concurrent.atomic` package. Getting this wrong is not academic: unsynchronized read-modify-write on a shared counter is the textbook race condition behind real production bugs, from lost e-commerce inventory decrements to double-spend bugs in early cryptocurrency wallet code.