Paper -- "The java.util.concurrent Synchronizer Framework"

最近在看Doug Lea的那篇基于AQS实现的理论论文。陆陆续续看了几遍。论文的问题就是作者会把一个或者一类具体问题进行抽象和总结,针对这个或这类问题进行研究,并试图站在一个更高的位置得出结论。这就导致,读这篇论文还是有点难的。主要的难点是细节理论的理解。毕竟这些论文看的少,很多上下文不是很懂,但是若是为了彻底理解这些,把引用的论文都看一遍,有点累。。。 我还是从作者的出发点开始理解吧,试图理解整个AQS为什么被设计成这样的。后续会跟着写几篇关于java memory model,reorder,barrier的文章,试图把整个多线程技术,从最顶层java实现到最底层现代cpu、寄存器、内存全部串起来。另类撸串:) Introduction 首先看看什么是synchronizer——同步器。所谓的synchronizer就是用来维护一组状态的变量,在java1.5发布的AQS中,就是一个32位的int,后面在java1.6发布的时候,又开发了基于long 64位的sycnronizer——AbstractQueuedLongSynchronizer。 Among these components are a set of synchronizers – abstract data type (ADT) classes that maintain an internal synchronization state (for example, representing whether a lock is locked or unlocked), operations to update and inspect that state, and at least one method that will cause a calling thread to block if the state requires it, resuming when some other thread changes the synchronization state to permit it....

December 10, 2016 · 2 min · magicalne