Fetch-And-Add
Let's look at one last hardware primitive for building locks, the fetch-and-add instruction.
We'll cover the following...
One final hardware primitive is the fetch-and-add instruction, which atomically increments a value while returning the old value at a particular address. The C pseudocode for the fetch-and-add instruction looks like this:
Access this course and 1400+ top-rated courses and projects.