随笔分类 -  JavaSE---并发

AtomicStampedReference
摘要:概述 An {@code AtomicStampedReference} maintains an object reference along with an integer "stamp", that can be updated atomically. 包含 一个对象引用 + 一个int的戳( 阅读全文

posted @ 2024-09-14 10:18 anpeiyong 阅读(7) 评论(0) 推荐(0) 编辑

ThreadPoolExecutor
摘要:概述 添加任务的流程 步骤 1:检查线程池状态首先,ThreadPoolExecutor 会检查当前线程池的状态,确保线程池还没有关闭。如果线程池已经关闭,会抛出 RejectedExecutionException。 步骤 2:检查核心线程数如果线程池的状态正常,ThreadPoolExecuto 阅读全文

posted @ 2023-10-26 17:12 anpeiyong 阅读(11) 评论(0) 推荐(0) 编辑

Semaphore
摘要:概述 A counting semaphore.Conceptually, a semaphore maintains a set of permits. 信号量计数器,维护一组许可; Each {@link #acquire} blocks if necessary until a permit 阅读全文

posted @ 2023-10-25 19:16 anpeiyong 阅读(13) 评论(0) 推荐(0) 编辑

锁优化
摘要:锁优化 高效并发 是从jdk1.5到jdk1.6的一个重要改进,HotSpot开发团队在这个版本上花费了大量的精力去实现各种锁优化技术:适应性自旋(Adaptive Spinning)、锁消除(Lock Elimination)、锁粗化(Lock Coarsening)、轻量级锁(Lightweig 阅读全文

posted @ 2023-10-25 14:57 anpeiyong 阅读(13) 评论(0) 推荐(0) 编辑

Unsafe
摘要:概述 Unsafe 类是Java平台的一部分,位于 sun.misc 包中。 这是一个非公开的类,意味着它不是为外部使用设计的,并且可能在未来的版本中更改或移除。 尽管如此,Unsafe 类提供了对底层硬件和内存模型的直接访问能力,这对于实现高性能的系统级编程非常有用。 特点 直接内存访问:Unsa 阅读全文

posted @ 2023-10-24 10:15 anpeiyong 阅读(4) 评论(0) 推荐(0) 编辑

AQS---ReentrantLock
摘要:概述 A reentrant mutual exclusion {@link Lock} with the same basic behavior and semantics as the implicit monitor lock accessed using {@code synchronize 阅读全文

posted @ 2023-10-23 17:03 anpeiyong 阅读(14) 评论(0) 推荐(0) 编辑

AbstractQueuedSynchronizer
摘要:总结 1、Java并发包的抽象类 2、简化自定义同步器的实现,为自定义的同步组件提供了一个基础框架 3、核心概念: 同步状态state:一个volatile的int成员变量,用于表示同步状态(自定义同步器共享的状态) 同步队列:维护了一个双向链表的FIFO的队列,用于存放等待获取同步状态的线程; 独 阅读全文

posted @ 2023-10-19 11:02 anpeiyong 阅读(15) 评论(0) 推荐(0) 编辑

AQS---CountDownLatch
摘要:概述 A synchronization aid that allows one or more threads to wait until a set of operations being performed in other threads completes. CountDownLatch是 阅读全文

posted @ 2023-10-18 17:12 anpeiyong 阅读(14) 评论(0) 推荐(0) 编辑

导航

< 2025年2月 >
26 27 28 29 30 31 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 1
2 3 4 5 6 7 8
点击右上角即可分享
微信分享提示