![](https://img-blog.csdnimg.cn/20200807172324280.jpg?x-oss-process=image/resize,m_fixed,h_224,w_224)
多线程
深入刨析线程的概念,大白话讲解,易学易懂!
丿烂人丶
路漫漫其修远兮,吾将上下而求索.
展开
-
多线程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-08-12 15:43:32 · 104 阅读 · 0 评论 -
多线程1
CAS Compare And Swap (Compare And Exchange) / 自旋 / 自旋锁 / 无锁 因为经常配合循环操作,直到完成为止,所以泛指一类操作 cas(v, a, b) ,变量v,期待值a, 修改值b ABA问题,你的女朋友在离开你的这段儿时间经历了别的人,自旋就是你空转等待,一直等到她接纳你为止 解决办法(版本号 AtomicStampedReference),基础类型简单值不需要版本号 Unsafe AtomicInteger: public final int incre原创 2020-08-12 15:41:53 · 126 阅读 · 0 评论 -
多线程高并发笔记
用户态与内核态 JDK早期,synchronized 叫做重量级锁, 因为申请锁资源必须通过kernel, 系统调用 ;hello.asm ;write(int fd, const void *buffer, size_t nbytes) section data msg db "Hello", 0xA len equ $ - msg section .text global _start _start: mov edx, len mov ecx, msg mo原创 2020-07-28 16:34:06 · 171 阅读 · 0 评论 -
你真的懂什么叫synchronized吗?
用户态与内核态 JDK早期,synchronized 叫做重量级锁, 因为申请锁资源必须通过kernel, 系统调用 ;hello.asm ;write(int fd, const void *buffer, size_t nbytes) section data msg db "Hello", 0xA len equ $ - msg section .text global _start _start: mov edx, len mov ecx, msg mo原创 2020-07-28 16:20:28 · 432 阅读 · 0 评论 -
多线程的各种基础知识02,成为大神的第一步!
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-07-28 16:01:08 · 131 阅读 · 0 评论 -
多线程的各种基础知识01,成为大神的第一步!
CAS Compare And Swap (Compare And Exchange) / 自旋 / 自旋锁 / 无锁 因为经常配合循环操作,直到完成为止,所以泛指一类操作 cas(v, a, b) ,变量v,期待值a, 修改值b ABA问题,你的女朋友在离开你的这段儿时间经历了别的人,自旋就是你空转等待,一直等到她接纳你为止 解决办法(版本号 AtomicStampedReference),基础类型简单值不需要版本号 Unsafe AtomicInteger: public final int incre原创 2020-07-28 15:57:55 · 165 阅读 · 0 评论