What operations does the Java memory model guarantee to be atomic?

as the title shows, many books and materials do not explicitly mention which operations are atomic, which is very important in writing concurrent programs.

Apr.01,2021

1: access, reading and writing of basic data types are atomic (main note: for 32-bit operating systems, the maximum length that can be processed by a single operation is 32bit, while the long type is 8-byte 64bit, so it takes two instructions to read and write to long (that is, the 32bit in 64bit each time). )
2: synchronization block (synchronized keyword)

Menu