摘要:
public class Demo4ABA { private static AtomicInteger ai = new AtomicInteger(100); private static AtomicStampedReference air = new AtomicStampedReferen 阅读全文
摘要:
public class Demo3Volatile { public static void main(String[] args) throws InterruptedException { VolatileDemo demo = new VolatileDemo(); List<Thread> 阅读全文
摘要:
public class Demo1Jmm { public static void main(String[] args) throws InterruptedException { JmmDemo demo = new JmmDemo(); Thread t = new Thread(demo) 阅读全文
摘要:
join作用是让其他线程变为等待。thread.Join把指定的线程加入到当前线程,可以将两个交替执行的线程合并为顺序执行的线程。比如在线程B中调用了线程A的Join()方法,直到线程A执行完毕后,才会继续执行线程B。 public class Demo11Join { public static 阅读全文
摘要:
public class Demo10Priorityt { public static void main(String[] args) { PrioritytThread prioritytThread = new PrioritytThread(); // 如果8核CPU处理3线程,无论优先级 阅读全文