![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
并行计算
UncleLPG
一个想要起飞的菜鸟
展开
-
多线程训练营资料1
CAS Compare And Swap (Compare And Exchange) / 自旋 / 自旋锁 / 无锁 因为经常配合循环操作,直到完成为止,所以泛指一类操作 cas(v, a, b) ,变量v,期待值a, 修改值b ABA问题,你的女朋友在离开你的这段儿时间经历了别的人,自旋就是你空转等待,一直等到她接纳你为止 解决办法(版本号 AtomicStampedReference),基础类型简单值不需要版本号 Unsafe AtomicInteger: public final int incre原创 2020-10-27 15:27:16 · 89 阅读 · 0 评论 -
多线程训练营资料2
volatile的用途 1.线程可见性 package com.mashibing.testvolatile; public class T01_ThreadVisibility { private static volatile boolean flag = true; public static void main(String[] args) throws InterruptedException { new Thread(()-> {原创 2020-10-27 15:27:51 · 106 阅读 · 0 评论