Secure Space

没有人非黑即白,人无完人

JDK8 JUC阅读(3)

LockSupport 工具类,主要作用是挂起,唤醒线程,为创建锁和其他同步类的基础。基于Unsafe实现 抽象同步队列AQS 实现同步器的基本组件,锁的底层使用AQS实现。 AQS本质是一个FIFO双端队列,队列类型为内部类Node AQS维持了一个单一的状态信息state,对于ReentarantLock,state表示当前线程获取锁的可重入次数;对于读写锁,高16位表示读状态(获取...

JDK8 JUC阅读(1)

原子操作类

LongAdder 解决高并发下多线程对一个变量不断进行CAS操作带来的性能上的损耗,LongAdder内部维护多个cells元素,分担了多线程对单个变量进行争夺的开销。 LongAdder的真实值为base+cells数组内的值,其中cells数组动态变化。 Cell构造如下 @sun.misc.Contended static final class Cell { ...

JDK8 JUC阅读(2)

并发List

JUC中的并发List只有CopyOnWriteArrayList,所有对其的操作都是在底层的一个对数组的复制上进行(写时复制) 初始化 无参构造函数 public CopyOnWriteArrayList() { setArray(new Object[0]); } 有参构造函数 //入参为集合,将内部元素复制到List public CopyOnWrite...

DDIA note part 5

Replication

Replication means keeping a copy of the same data on multiple machines that are connected via a network. The main difficulty in replication lies in handling changes to replication data. A Simple...

PBRT note part 4

Color and Radiometry

About radiometry,our particular interests are the wavelengt of electromagnetic radiation between approximately 380 nm and 780 nm, which account for light visible to humans.The lower is blue,the mi...

Raft

an Understandable Consensus Algorithm

​ The primary goal of the raft is to find a more understandable consensus algorithm than traditional Paxos,which is in a domination but unfortunately hard to realize in praticle. Serveral novel fe...

PBRT note part 3

Shapes

Basic Shape Interface All shapes are defined in coordinate space,in order to place them to world space,a transformation must be provided. Shapes take parameter reverseOrientation to indicates their...

PBR学习笔记

基于物理的渲染

大纲 资料汇总 SIGGRAPH course:http://renderwonk.com/publications/ 《Real-Time rendering 4th》:http://www.realtimerendering.com/ 《Physically based rendering 3rd》:http://www.pbr-book.org/3ed-2018/co...

New start

New era

DDIA note part 3

Storage and Retrieval

How we can store the data we’re given,and how we find it again when asked? Data Structures That Power Your Database Assume there is a very simple database,composed of key and value,and the unde...