As I know, 64bit integer work differently by operation system. I could find out that is true in assembly instructions. Below like this.
#include <iostream>
int main()
{
uint64_t sharedValue = 0;
sharedValue = 0x100000002;
}
So I thought a 32bit operation system couldn't guarantee the atomicity of the 64bit integer because the operation consists of multiple instructions. But 64bit operation system can.
So I checked the 64-bit integer. To see how atomicity is guaranteed depending on the operating system.
#include <iostream>
#include <atomic>
using namespace std;
int main()
{
atomic<uint64_t> num;
cout << boolalpha << num.is_lock_free() << endl;
}
32bit atomicity 64bit atomicity
As I know, 'lock_is_free = true' means this type can be processed atomically in the CPU.
if i understood correctly, why dose a 64bit integer on 32bit os return 'true' by lock_is_free().
Assembly codes are multiple, but some operations can be processed atomicity on CPU??
Please, Answer my problem.