Previous | Next --- Slide 18 of 43
Back to Lecture Thumbnails

What does bnz here mean? I assume that it's a jump statement activated when the register is non-zero. But I tried to search for such instructions online. Couldnt find them. Shouldn't they be in the x86 instruction set?


@sidwad, bnz means "Brach if non-zero", I believe it's a MIPS instruction.


To summarize this slide: In a lock, each processor checks if the value at the memory address (the lock) is 0. If the address is 0, then the lock isn't currently taken, and the processor can take the lock. In this slide, however, different processors can see that the lock = 0 at the same time, and set it to 1 leading to a data race.


Note: The cmp instruction here returns zero if the comparison succeeds and non-zero otherwise.


@eknight7 what do you mean by if the comparison succeeds? Doesnt the cmp instruction set the respective flag and not return zero or non-zero?