1. In the case of less resource competition, cas>synchronized, which wastes additional CPU resources by using synchronized synchronization synchronization lock for thread blocking, wake up switch and switch operation between user-mode kernel states; CAS, on the other hand, is hardware-based, does not need to enter the kernel, does not need to switch threads, and operates with less spin, thus achieving higher performance.

2. In the case of serious resource competition: cas<synchronized, the probability of CAS spin is larger, thus wasting more CPU resources and achieving lower efficiency than synchronized.

end