NVIDIA Interview Question

Implement an atomic compare and swap.