synchronized与static synchronized 的区别、synchronized在JVM底层的实现原理及Java多线程锁理解

本Blog分为如下部分:

第一部分:synchronized与static
synchronized 的区别

第二部分:JVM底层又是如何实现synchronized的

第三部分:Java多线程锁,源代码剖析

第一部分:synchronized与static synchronized的区别

1、synchronized与static synchronized 的区别

synchronized是对类的当前实例进行加锁,防止其他线程同时访问该类的该实例的所有synchronized块,注意这里是“类的当前实例”,类的两个不同实例就没有这种约束了。那么static synchronized恰好就是要控制类的所有实例的访问了,static synchronized是限制线程同时访问jvm中该类的所有实例同时访问对应的代码快。实际上,在类中某方法或某代码块中有 synchronized,那么在生成一个该类实例后,该类也就有一个监视快,放置线程并发访问该实例synchronized保护快,而static
synchronized则是所有该类的实例公用一个监视快了
,也就是两个的区别了,也就是synchronized相当于this.synchronized,而staticsynchronized相当于Something.synchronized.

pulbic class Something(){

public synchronized void isSyncA(){}

public synchronized voidisSyncB(){}

public static synchronizedvoid cSyncA(){}

public static synchronizedvoid cSyncB(){}

}

注解:该列子来自一个日本作者-结成浩的《java多线程设计模式》

那么,假如有Something类的两个实例a与b,那么下列组方法何以被1个以上线程同时访问呢

a.   x.isSyncA()与x.isSyncB()

b.   x.isSyncA()与y.isSyncA()

c.   x.cSyncA()与y.cSyncB()

d.   x.isSyncA()与Something.cSyncA()

这里,很清楚的可以判断:

a,都是对同一个实例的synchronized域访问,因此不能被同时访问

b,是针对不同实例的,因此可以同时被访问

c,因为是staticsynchronized,所以不同实例之间仍然会被限制,相当于Something.isSyncA()与   Something.isSyncB()了,因此不能被同时访问。

那么,第d呢?,书上的 答案是可以被同时访问的,答案理由是synchronzied的是实例方法与synchronzied的类方法由于锁定(lock)不同的原因。

个人分析也就是synchronized 与static synchronized 相当于两帮派,各自管各自,相互之间就无约束了,可以被同时访问。后面一部分将详细分析synchronzied是怎么样实现的

结论:

A: synchronized static是某个类的范围,synchronized static cSync{}防止多个线程同时访问这个类中的synchronized static 方法。它可以对类的所有对象实例起作用。

B: synchronized 是某实例的范围,synchronized isSync(){}防止多个线程同时访问这个实例中的synchronized 方法。

2、synchronized方法与synchronized代码快的区别

synchronizedmethods(){}
与synchronized(this){}之间没有什么区别,只是 synchronized methods(){} 便于阅读理解,而synchronized(this){}可以更精确的控制冲突限制访问区域,有时候表现更高效率。

3、synchronized关键字是不能继承的

也就是说,基类的方法synchronized f(){} 在继承类中并不自动是synchronized f(){},而是变成了f(){}。继承类需要你显式的指定它的某个方法为synchronized方法;

4、从源代码详细理解synchronized关键字(参考Observable类源码)

Java中的Observer模式,看了其中的Observable类的源码,发现里面几乎所有的方法都用了synchronized关键字(不是全部),其中个别用了synchronized(this){}的区块

参考网址:

http://www.learndiary.com/archives/diaries/2910.htm

http://www.cnblogs.com/shipengzhi/articles/2223100.html

第二部分:JVM底层又是如何实现synchronized的

目前在Java中存在两种锁机制:synchronized和Lock,Lock接口及其实现类是JDK5增加的内容,其作者是大名鼎鼎的并发专家DougLea。本文并不比较synchronized与Lock孰优孰劣,只是介绍二者的实现原理。

数据同步需要依赖锁,那锁的同步又依赖谁?synchronized给出的答案是在软件层面依赖JVM,而Lock给出的方案是在硬件层面依赖特殊的CPU指令,大家可能会进一步追问:JVM底层又是如何实现synchronized的?

本文所指说的JVM是指Hotspot的6u23版本,下面首先介绍synchronized的实现:

synrhronized关键字简洁、清晰、语义明确,因此即使有了Lock接口,使用的还是非常广泛。其应用层的语义是可以把任何一个非null对象作为"锁",当synchronized作用在方法上时,锁住的便是对象实例(this);当作用在静态方法时锁住的便是对象对应的Class实例,因为 Class数据存在于永久带,因此静态方法锁相当于该类的一个全局锁;当synchronized作用于某一个对象实例时,锁住的便是对应的代码块。在HotSpot JVM实现中,锁有个专门的名字:对象监视器。

1. 线程状态及状态转换

当多个线程同时请求某个对象监视器时,对象监视器会设置几种状态用来区分请求的线程:

ContentionList:所有请求锁的线程将被首先放置到该竞争队列

EntryList:ContentionList中那些有资格成为候选人的线程被移到Entry List

WaitSet:那些调用wait方法被阻塞的线程被放置到Wait Set

OnDeck:任何时刻最多只能有一个线程正在竞争锁,该线程称为OnDeck

Owner:获得锁的线程称为Owner

!Owner:释放锁的线程

下图反映了这个状态转换关系:

新请求锁的线程将首先被加入到ConetentionList中,当某个拥有锁的线程(Owner状态)调用unlock之后,如果发现 EntryList为空则从ContentionList中移动线程到EntryList,下面说明下ContentionList和EntryList 的实现方式:

1.1 ContentionList 虚拟队列

ContentionList并不是一个真正的Queue,而只是一个虚拟队列,原因在于ContentionList是由Node及其next指 针逻辑构成,并不存在一个Queue的数据结构。ContentionList是一个后进先出(LIFO)的队列,每次新加入Node时都会在队头进行, 通过CAS改变第一个节点的的指针为新增节点,同时设置新增节点的next指向后续节点,而取得操作则发生在队尾。显然,该结构其实是个Lock- Free的队列。

因为只有Owner线程才能从队尾取元素,也即线程出列操作无争用,当然也就避免了CAS的ABA问题。

1.2 EntryList

EntryList与ContentionList逻辑上同属等待队列,ContentionList会被线程并发访问,为了降低对 ContentionList队尾的争用,而建立EntryList。Owner线程在unlock时会从ContentionList中迁移线程到 EntryList,并会指定EntryList中的某个线程(一般为Head)为Ready(OnDeck)线程。Owner线程并不是把锁传递给 OnDeck线程,只是把竞争锁的权利交给OnDeck,OnDeck线程需要重新竞争锁。这样做虽然牺牲了一定的公平性,但极大的提高了整体吞吐量,在
Hotspot中把OnDeck的选择行为称之为“竞争切换”。

OnDeck线程获得锁后即变为owner线程,无法获得锁则会依然留在EntryList中,考虑到公平性,在EntryList中的位置不 发生变化(依然在队头)。如果Owner线程被wait方法阻塞,则转移到WaitSet队列;如果在某个时刻被notify/notifyAll唤醒, 则再次转移到EntryList。

2. 自旋锁

那些处于ContetionList、EntryList、WaitSet中的线程均处于阻塞状态,阻塞操作由操作系统完成(在Linxu下通 过pthread_mutex_lock函数)。线程被阻塞后便进入内核(Linux)调度状态,这个会导致系统在用户态与内核态之间来回切换,严重影响 锁的性能

缓解上述问题的办法便是自旋,其原理是:当发生争用时,若Owner线程能在很短的时间内释放锁,则那些正在争用线程可以稍微等一等(自旋), 在Owner线程释放锁后,争用线程可能会立即得到锁,从而避免了系统阻塞。但Owner运行的时间可能会超出了临界值,争用线程自旋一段时间后还是无法 获得锁,这时争用线程则会停止自旋进入阻塞状态(后退)。基本思路就是自旋,不成功再阻塞,尽量降低阻塞的可能性,这对那些执行时间很短的代码块来说有非 常重要的性能提高。自旋锁有个更贴切的名字:自旋-指数后退锁,也即复合锁。很显然,自旋在多处理器上才有意义。

还有个问题是,线程自旋时做些啥?其实啥都不做,可以执行几次for循环,可以执行几条空的汇编指令,目的是占着CPU不放,等待获取锁的机 会。所以说,自旋是把双刃剑,如果旋的时间过长会影响整体性能,时间过短又达不到延迟阻塞的目的。显然,自旋的周期选择显得非常重要,但这与操作系统、硬 件体系、系统的负载等诸多场景相关,很难选择,如果选择不当,不但性能得不到提高,可能还会下降,因此大家普遍认为自旋锁不具有扩展性。

自旋优化策略

对自旋锁周期的选择上,HotSpot认为最佳时间应是一个线程上下文切换的时间,但目前并没有做到。经过调查,目前只是通过汇编暂停了几个CPU周期,除了自旋周期选择,HotSpot还进行许多其他的自旋优化策略,具体如下:

如果平均负载小于CPUs则一直自旋

如果有超过(CPUs/2)个线程正在自旋,则后来线程直接阻塞

如果正在自旋的线程发现Owner发生了变化则延迟自旋时间(自旋计数)或进入阻塞

如果CPU处于节电模式则停止自旋

自旋时间的最坏情况是CPU的存储延迟(CPU A存储了一个数据,到CPU B得知这个数据直接的时间差)

自旋时会适当放弃线程优先级之间的差异

那synchronized实现何时使用了自旋锁?答案是在线程进入ContentionList时,也即第一步操作前。线程在进入等待队列时 首先进行自旋尝试获得锁,如果不成功再进入等待队列。这对那些已经在等待队列中的线程来说,稍微显得不公平。还有一个不公平的地方是自旋线程可能会抢占了 Ready线程的锁。自旋锁由每个监视对象维护,每个监视对象一个。

3. JVM1.6偏向锁

在JVM1.6中引入了偏向锁,偏向锁主要解决无竞争下的锁性能问题,首先我们看下无竞争下锁存在什么问题:

现在几乎所有的锁都是可重入的,也即已经获得锁的线程可以多次锁住/解锁监视对象,按照之前的HotSpot设计,每次加锁/解锁都会涉及到一些CAS操 作(比如对等待队列的CAS操作),CAS操作会延迟本地调用,因此偏向锁的想法是一旦线程第一次获得了监视对象,之后让监视对象“偏向”这个 线程,之后的多次调用则可以避免CAS操作,说白了就是置个变量,如果发现为true则无需再走各种加锁/解锁流程。但还有很多概念需要解释、很多引入的 问题需要解决:

3.1 CAS及SMP架构

CAS为什么会引入本地延迟?这要从SMP(对称多处理器)架构说起,下图大概表明了SMP的结构:

其意思是所有的CPU会共享一条系统总线(BUS),靠此总线连接主存。每个核都有自己的一级缓存,各核相对于BUS对称分布,因此这种结构称为“对称多处理器”。

而CAS的全称为Compare-And-Swap,是一条CPU的原子指令,其作用是让CPU比较后原子地更新某个位置的值,经过调查发现, 其实现方式是基于硬件平台的汇编指令,就是说CAS是靠硬件实现的,JVM只是封装了汇编调用,那些AtomicInteger类便是使用了这些封装后的 接口。

Core1和Core2可能会同时把主存中某个位置的值Load到自己的L1 Cache中,当Core1在自己的L1 Cache中修改这个位置的值时,会通过总线,使Core2中L1 Cache对应的值“失效”,而Core2一旦发现自己L1 Cache中的值失效(称为Cache命中缺失)则会通过总线从内存中加载该地址最新的值,大家通过总线的来回通信称为“Cache一致性流量”,因为总 线被设计为固定的“通信能力”,如果Cache一致性流量过大,总线将成为瓶颈。而当Core1和Core2中的值再次一致时,称为“Cache一致
性”,从这个层面来说,锁设计的终极目标便是减少Cache一致性流量。

而CAS恰好会导致Cache一致性流量,如果有很多线程都共享同一个对象,当某个Core CAS成功时必然会引起总线风暴,这就是所谓的本地延迟,本质上偏向锁就是为了消除CAS,降低Cache一致性流量。

Cache一致性:

上面提到Cache一致性,其实是有协议支持的,现在通用的协议是MESI(最早由Intel开始支持),具体参考:http://en.wikipedia.org/wiki/MESI_protocol,以后会仔细讲解这部分。

Cache一致性流量的例外情况:

其实也不是所有的CAS都会导致总线风暴,这跟Cache一致性协议有关,具体参考:http://blogs.oracle.com/dave/entry/biased_locking_in_hotspot

NUMA(Non Uniform Memory Access Achitecture)架构:

与SMP对应还有非对称多处理器架构,现在主要应用在一些高端处理器上,主要特点是没有总线,没有公用主存,每个Core有自己的内存,针对这种结构此处不做讨论。

3.2 偏向解除

偏向锁引入的一个重要问题是,在多争用的场景下,如果另外一个线程争用偏向对象,拥有者需要释放偏向锁,而释放的过程会带来一些性能开销,但总体说来偏向锁带来的好处还是大于CAS代价的。

4. 总结

关于锁,JVM中还引入了一些其他技术比如锁膨胀等,这些与自旋锁、偏向锁相比影响不是很大,这里就不做介绍。

通过上面的介绍可以看出,synchronized的底层实现主要依靠Lock-Free的队列,基本思路是自旋后阻塞,竞争切换后继续竞争锁,稍微牺牲了公平性,但获得了高吞吐量。

参考文献:http://www.open-open.com/lib/view/open1352431526366.html

第三部分:Java多线程锁,源代码剖析

多线程的同步依靠的是锁机制,java中可通过synchronized关键字锁锁住共享资源以实现异步多线程的达到同步。总结起来,要达到同步,我们要做的就是构造各线程间的共享资源,其中的共享资源可以对象,也可以是方法。

package algorithms.com.guan.zoo.stackTest;

public class LockDemo {
	public static void main(String[] args) {
		MyRunnerVarLock runnerVarLock = new MyRunnerVarLock(new Integer(0));
		MyRunnerFuncLock runnerFuncLock = new MyRunnerFuncLock();
		MyRunnerNoLock runnerNoLock = new MyRunnerNoLock(); 

		// 对共享对象进行加锁,线程会依次打印0-99的数,每一次运行的结果都一样
		for(int i = 0; i < 10; i++) {
			Thread thread = new Thread(runnerVarLock);
			thread.start();
		}

		// 对共享函数进行加锁,线程会依次打印0-99的数,每一次运行的结果都一样
		for(int i = 0; i < 10; i++) {
			Thread thread = new Thread(runnerFuncLock);
			thread.start();
		}

		// 未加锁,会因为线程调用的时序不同而发生变化,每一次运行的结果不一定相同
		for(int i = 0; i < 10; i++) {
			Thread thread = new Thread(runnerNoLock);
			thread.start();
		}
	}
}

// 对共享对象进行加锁
class MyRunnerVarLock implements Runnable {
	private Object lock;

	public MyRunnerVarLock(Object lock) {
		this.lock = lock;
	}

	public void run() {
		synchronized (lock) {
			for (int i = 0; i < 100; i++) {
				System.out.println("Lock: " + i);
			}
		}
	}
}

// 对共享函数进行加锁
class MyRunnerFuncLock implements Runnable {
	public synchronized void run() {
		for (int i = 0; i < 100; i++) {
			System.out.println("Func lock: " + i);
		}
	}
}

// 没有加锁
class MyRunnerNoLock implements Runnable {
	public void run() {
		for (int i = 0; i < 100; i++) {
			System.out.println("No lock: " + i);
		}
	}
}

运行结果如下所示(尽供参考分析):

Lock: 0

Lock: 1

Lock: 2

Lock: 3

Lock: 4

Lock: 5

Lock: 6

Lock: 7

Lock: 8

Lock: 9

Lock: 10

Lock: 11

Lock: 12

Lock: 13

Lock: 14

Lock: 15

Lock: 16

Lock: 17

Lock: 18

Lock: 19

Lock: 20

Lock: 21

Lock: 22

Lock: 23

Lock: 24

Lock: 25

Lock: 26

Lock: 27

Lock: 28

Lock: 29

Lock: 30

Lock: 31

Lock: 32

Lock: 33

Lock: 34

Func lock: 0

Func lock: 1

Lock: 35

Func lock: 2

Lock: 36

Lock: 37

Lock: 38

Lock: 39

Lock: 40

Func lock: 3

Lock: 41

Func lock: 4

Lock: 42

Lock: 43

Lock: 44

Func lock: 5

Func lock: 6

Func lock: 7

Func lock: 8

Func lock: 9

Func lock: 10

Func lock: 11

Lock: 45

Lock: 46

Lock: 47

Lock: 48

Func lock: 12

No lock: 0

No lock: 0

No lock: 0

Lock: 49

Lock: 50

No lock: 1

No lock: 1

No lock: 1

Func lock: 13

Func lock: 14

No lock: 2

No lock: 3

No lock: 0

No lock: 2

No lock: 0

No lock: 2

Lock: 51

No lock: 0

No lock: 0

No lock: 0

No lock: 1

Lock: 52

No lock: 0

No lock: 3

No lock: 1

No lock: 0

No lock: 3

No lock: 4

No lock: 5

No lock: 1

No lock: 4

Func lock: 15

No lock: 5

No lock: 2

No lock: 6

No lock: 1

No lock: 2

No lock: 4

No lock: 1

Lock: 53

No lock: 2

No lock: 1

No lock: 1

No lock: 2

No lock: 3

Lock: 54

No lock: 2

No lock: 5

No lock: 6

No lock: 3

No lock: 2

No lock: 7

No lock: 3

No lock: 6

Func lock: 16

No lock: 7

No lock: 4

No lock: 8

No lock: 3

No lock: 4

No lock: 5

No lock: 7

No lock: 3

Lock: 55

No lock: 4

No lock: 3

No lock: 2

No lock: 3

No lock: 4

No lock: 5

No lock: 6

Lock: 56

No lock: 4

No lock: 8

No lock: 6

No lock: 4

No lock: 9

No lock: 5

No lock: 8

Func lock: 17

No lock: 9

No lock: 6

No lock: 10

No lock: 5

No lock: 7

No lock: 9

No lock: 10

No lock: 5

Lock: 57

No lock: 7

No lock: 5

No lock: 4

No lock: 6

No lock: 8

Lock: 58

No lock: 6

No lock: 11

No lock: 8

No lock: 6

No lock: 11

No lock: 7

No lock: 10

Func lock: 18

No lock: 11

No lock: 8

No lock: 12

No lock: 13

No lock: 14

No lock: 7

No lock: 9

No lock: 12

No lock: 7

Lock: 59

No lock: 9

No lock: 7

No lock: 5

No lock: 8

No lock: 10

Lock: 60

No lock: 8

No lock: 13

No lock: 10

No lock: 8

No lock: 15

No lock: 16

No lock: 9

No lock: 12

Func lock: 19

No lock: 13

No lock: 10

No lock: 17

No lock: 9

No lock: 10

No lock: 11

No lock: 12

No lock: 11

No lock: 14

No lock: 9

Lock: 61

No lock: 11

No lock: 9

No lock: 6

No lock: 10

No lock: 12

No lock: 13

Lock: 62

No lock: 10

No lock: 15

No lock: 12

No lock: 13

No lock: 18

No lock: 11

No lock: 14

Func lock: 20

No lock: 15

No lock: 12

No lock: 19

No lock: 14

No lock: 13

No lock: 16

No lock: 11

No lock: 12

Lock: 63

Lock: 64

No lock: 14

No lock: 11

No lock: 7

No lock: 12

No lock: 15

Lock: 65

No lock: 13

No lock: 17

No lock: 14

No lock: 15

No lock: 20

No lock: 13

No lock: 16

Func lock: 21

No lock: 17

No lock: 14

No lock: 21

No lock: 22

No lock: 16

No lock: 15

No lock: 18

No lock: 14

Lock: 66

No lock: 16

No lock: 13

No lock: 8

No lock: 14

No lock: 17

Lock: 67

No lock: 15

No lock: 19

No lock: 16

No lock: 17

No lock: 23

No lock: 24

No lock: 15

No lock: 18

Func lock: 22

No lock: 19

No lock: 16

No lock: 25

No lock: 18

No lock: 17

No lock: 20

No lock: 16

Lock: 68

No lock: 18

No lock: 15

No lock: 9

No lock: 16

No lock: 19

Lock: 69

Lock: 70

No lock: 17

No lock: 18

No lock: 21

No lock: 18

No lock: 19

No lock: 26

No lock: 17

No lock: 20

Func lock: 23

No lock: 21

No lock: 18

No lock: 27

No lock: 20

No lock: 19

No lock: 22

No lock: 19

No lock: 20

Lock: 71

No lock: 20

No lock: 17

No lock: 10

No lock: 18

No lock: 21

Lock: 72

No lock: 21

No lock: 23

No lock: 20

No lock: 21

No lock: 28

No lock: 19

No lock: 22

Func lock: 24

No lock: 23

No lock: 24

No lock: 20

No lock: 29

No lock: 30

No lock: 22

No lock: 21

No lock: 24

No lock: 22

Lock: 73

No lock: 22

No lock: 19

No lock: 11

No lock: 20

No lock: 21

No lock: 23

Lock: 74

No lock: 23

No lock: 25

No lock: 22

No lock: 23

No lock: 31

No lock: 21

No lock: 25

Func lock: 25

No lock: 26

No lock: 22

No lock: 32

No lock: 24

No lock: 23

No lock: 24

No lock: 25

No lock: 26

No lock: 26

No lock: 27

No lock: 24

Lock: 75

No lock: 24

No lock: 22

No lock: 12

No lock: 23

No lock: 25

Lock: 76

No lock: 25

No lock: 28

No lock: 27

No lock: 25

No lock: 33

No lock: 23

No lock: 24

No lock: 27

Func lock: 26

No lock: 28

No lock: 25

No lock: 26

No lock: 34

No lock: 26

No lock: 28

No lock: 29

No lock: 26

Lock: 77

No lock: 26

No lock: 24

No lock: 13

No lock: 25

No lock: 27

Lock: 78

No lock: 27

No lock: 30

No lock: 29

No lock: 27

No lock: 35

No lock: 27

No lock: 29

Func lock: 27

No lock: 30

No lock: 28

No lock: 36

No lock: 28

No lock: 30

No lock: 31

No lock: 28

Lock: 79

No lock: 28

No lock: 26

No lock: 14

No lock: 27

No lock: 29

Lock: 80

Lock: 81

No lock: 29

No lock: 32

No lock: 33

No lock: 31

No lock: 29

No lock: 37

No lock: 29

No lock: 31

Func lock: 28

No lock: 32

No lock: 30

No lock: 38

No lock: 30

No lock: 32

No lock: 34

No lock: 30

Lock: 82

Lock: 83

No lock: 30

No lock: 28

No lock: 15

No lock: 29

No lock: 31

Lock: 84

No lock: 31

No lock: 35

No lock: 33

No lock: 31

No lock: 39

No lock: 31

No lock: 33

Func lock: 29

No lock: 34

No lock: 32

No lock: 40

No lock: 41

No lock: 32

No lock: 34

No lock: 36

No lock: 37

No lock: 32

No lock: 33

Lock: 85

No lock: 32

No lock: 30

No lock: 16

No lock: 31

No lock: 33

Lock: 86

No lock: 34

No lock: 38

No lock: 39

No lock: 35

No lock: 33

No lock: 42

No lock: 33

No lock: 35

Func lock: 30

No lock: 36

No lock: 34

No lock: 43

No lock: 34

No lock: 35

No lock: 36

No lock: 40

No lock: 35

Lock: 87

No lock: 34

No lock: 32

No lock: 33

No lock: 17

No lock: 34

No lock: 35

Lock: 88

No lock: 36

No lock: 41

No lock: 37

No lock: 36

No lock: 44

No lock: 35

No lock: 37

Func lock: 31

No lock: 38

No lock: 36

No lock: 37

No lock: 45

No lock: 37

No lock: 38

No lock: 39

No lock: 42

No lock: 43

No lock: 37

Lock: 89

No lock: 36

No lock: 35

No lock: 18

No lock: 36

No lock: 37

Lock: 90

Lock: 91

No lock: 38

No lock: 44

No lock: 40

No lock: 38

No lock: 46

No lock: 38

No lock: 39

Func lock: 32

No lock: 40

No lock: 39

No lock: 47

No lock: 39

No lock: 40

No lock: 41

No lock: 45

No lock: 39

Lock: 92

No lock: 38

No lock: 37

No lock: 19

No lock: 20

No lock: 38

No lock: 39

No lock: 39

Lock: 93

No lock: 40

No lock: 46

No lock: 42

No lock: 41

No lock: 48

No lock: 40

No lock: 41

Func lock: 33

No lock: 42

No lock: 41

No lock: 49

No lock: 50

No lock: 42

No lock: 43

No lock: 44

No lock: 43

No lock: 47

No lock: 48

No lock: 41

No lock: 42

No lock: 43

No lock: 44

Lock: 94

No lock: 40

No lock: 40

No lock: 21

No lock: 41

No lock: 42

No lock: 43

No lock: 44

No lock: 41

Lock: 95

No lock: 45

No lock: 49

No lock: 44

No lock: 45

No lock: 51

No lock: 42

No lock: 43

No lock: 44

Func lock: 34

No lock: 45

No lock: 43

No lock: 52

No lock: 46

No lock: 45

No lock: 50

No lock: 46

Lock: 96

No lock: 42

No lock: 45

No lock: 22

No lock: 46

No lock: 43

Lock: 97

No lock: 47

No lock: 51

No lock: 52

No lock: 46

No lock: 47

No lock: 53

No lock: 44

No lock: 46

Func lock: 35

No lock: 47

No lock: 45

No lock: 54

No lock: 48

No lock: 47

No lock: 53

No lock: 48

Lock: 98

No lock: 44

No lock: 45

No lock: 47

No lock: 23

No lock: 48

No lock: 46

No lock: 47

No lock: 48

Lock: 99

No lock: 49

Lock: 0

No lock: 54

No lock: 48

No lock: 49

No lock: 55

No lock: 46

No lock: 48

No lock: 49

Func lock: 36

No lock: 50

No lock: 47

No lock: 56

No lock: 50

No lock: 49

No lock: 50

No lock: 51

No lock: 55

Lock: 1

No lock: 50

No lock: 49

No lock: 49

No lock: 24

No lock: 50

No lock: 50

No lock: 51

Lock: 2

No lock: 56

No lock: 52

No lock: 53

No lock: 51

No lock: 57

No lock: 48

No lock: 51

Func lock: 37

No lock: 52

No lock: 49

No lock: 58

No lock: 52

No lock: 54

No lock: 57

Lock: 3

No lock: 52

No lock: 51

No lock: 52

No lock: 51

No lock: 25

No lock: 52

No lock: 53

No lock: 53

Lock: 4

No lock: 58

No lock: 55

No lock: 53

No lock: 59

No lock: 50

No lock: 53

Func lock: 38

No lock: 54

No lock: 51

No lock: 60

No lock: 61

No lock: 54

No lock: 56

No lock: 59

Lock: 5

No lock: 54

No lock: 55

No lock: 54

No lock: 53

No lock: 26

No lock: 54

No lock: 55

No lock: 56

Lock: 6

No lock: 60

No lock: 57

No lock: 58

No lock: 55

No lock: 62

No lock: 52

No lock: 55

No lock: 56

Func lock: 39

No lock: 57

No lock: 53

No lock: 63

No lock: 56

No lock: 59

No lock: 61

Lock: 7

No lock: 57

No lock: 56

No lock: 55

No lock: 27

No lock: 56

No lock: 57

No lock: 58

Lock: 8

No lock: 62

No lock: 60

No lock: 57

No lock: 64

No lock: 54

No lock: 58

Func lock: 40

No lock: 59

No lock: 55

No lock: 65

No lock: 58

No lock: 61

No lock: 63

Lock: 9

No lock: 59

No lock: 58

No lock: 57

No lock: 28

No lock: 58

No lock: 59

No lock: 60

Lock: 10

Lock: 11

Lock: 12

No lock: 64

No lock: 62

No lock: 59

No lock: 66

No lock: 56

No lock: 60

Func lock: 41

No lock: 61

No lock: 57

No lock: 58

No lock: 67

No lock: 60

No lock: 63

No lock: 65

Lock: 13

No lock: 61

No lock: 60

No lock: 61

No lock: 59

No lock: 60

No lock: 61

No lock: 62

No lock: 29

No lock: 63

No lock: 30

No lock: 62

No lock: 62

Lock: 14

No lock: 66

No lock: 64

No lock: 61

No lock: 68

No lock: 59

No lock: 62

Func lock: 42

No lock: 63

No lock: 60

No lock: 61

No lock: 69

No lock: 62

No lock: 65

No lock: 67

Lock: 15

No lock: 63

No lock: 63

No lock: 31

No lock: 64

No lock: 32

No lock: 64

No lock: 64

Lock: 16

Lock: 17

No lock: 68

No lock: 66

No lock: 63

No lock: 70

No lock: 62

No lock: 64

Func lock: 43

No lock: 65

No lock: 63

No lock: 71

No lock: 64

No lock: 67

No lock: 69

Lock: 18

No lock: 65

No lock: 66

No lock: 67

No lock: 65

No lock: 33

No lock: 65

No lock: 34

No lock: 66

No lock: 68

Lock: 19

No lock: 70

No lock: 68

No lock: 65

No lock: 72

No lock: 64

No lock: 65

No lock: 66

Func lock: 44

Func lock: 45

Func lock: 46

Func lock: 47

No lock: 67

No lock: 66

No lock: 73

No lock: 66

No lock: 67

No lock: 69

No lock: 71

Lock: 20

No lock: 69

No lock: 67

No lock: 35

No lock: 66

No lock: 67

No lock: 36

No lock: 37

No lock: 68

No lock: 70

Lock: 21

No lock: 72

No lock: 70

No lock: 68

No lock: 74

No lock: 67

No lock: 68

Func lock: 48

No lock: 69

No lock: 68

No lock: 75

No lock: 69

No lock: 71

No lock: 73

Lock: 22

Lock: 23

No lock: 71

No lock: 69

No lock: 38

No lock: 68

No lock: 39

No lock: 70

No lock: 72

Lock: 24

No lock: 74

No lock: 72

No lock: 70

No lock: 76

No lock: 69

No lock: 70

No lock: 70

Func lock: 49

No lock: 71

No lock: 71

No lock: 77

No lock: 71

No lock: 73

No lock: 75

Lock: 25

No lock: 73

No lock: 71

No lock: 40

No lock: 69

No lock: 41

No lock: 72

No lock: 74

Lock: 26

Lock: 27

No lock: 76

No lock: 77

No lock: 74

No lock: 75

No lock: 72

No lock: 78

No lock: 72

No lock: 72

Func lock: 50

No lock: 73

No lock: 74

No lock: 73

No lock: 79

No lock: 73

No lock: 76

No lock: 77

No lock: 78

No lock: 78

Lock: 28

No lock: 75

No lock: 73

No lock: 42

No lock: 70

No lock: 71

No lock: 43

No lock: 74

No lock: 76

Lock: 29

No lock: 79

No lock: 80

No lock: 81

No lock: 79

No lock: 74

No lock: 80

No lock: 81

No lock: 82

No lock: 74

No lock: 75

Func lock: 51

No lock: 76

No lock: 77

No lock: 75

No lock: 83

No lock: 75

No lock: 80

No lock: 82

Lock: 30

No lock: 77

No lock: 75

No lock: 44

No lock: 45

No lock: 72

No lock: 46

No lock: 76

No lock: 78

Lock: 31

No lock: 83

No lock: 81

No lock: 76

No lock: 84

No lock: 76

No lock: 78

Func lock: 52

No lock: 79

No lock: 77

No lock: 78

No lock: 85

No lock: 77

No lock: 78

No lock: 82

No lock: 84

Lock: 32

No lock: 79

No lock: 77

No lock: 47

No lock: 73

No lock: 48

No lock: 74

No lock: 78

No lock: 79

No lock: 80

Lock: 33

No lock: 85

No lock: 83

No lock: 79

No lock: 86

No lock: 79

No lock: 80

Func lock: 53

No lock: 81

No lock: 80

No lock: 87

No lock: 88

No lock: 80

No lock: 84

No lock: 86

Lock: 34

No lock: 81

No lock: 80

No lock: 75

No lock: 49

No lock: 76

No lock: 81

No lock: 82

Lock: 35

No lock: 87

No lock: 85

No lock: 81

No lock: 82

No lock: 89

No lock: 81

No lock: 82

Func lock: 54

No lock: 83

No lock: 82

No lock: 90

No lock: 83

No lock: 86

No lock: 88

Lock: 36

No lock: 83

No lock: 82

No lock: 77

No lock: 50

No lock: 78

No lock: 83

No lock: 84

No lock: 84

Lock: 37

No lock: 89

No lock: 87

No lock: 84

No lock: 91

No lock: 83

No lock: 84

Func lock: 55

No lock: 85

No lock: 84

No lock: 92

No lock: 85

No lock: 86

No lock: 88

No lock: 90

Lock: 38

No lock: 85

No lock: 85

No lock: 79

No lock: 51

No lock: 80

No lock: 86

No lock: 86

Lock: 39

No lock: 91

No lock: 89

No lock: 87

No lock: 93

No lock: 94

No lock: 85

No lock: 86

No lock: 86

Func lock: 56

No lock: 87

No lock: 87

No lock: 95

No lock: 88

No lock: 90

No lock: 92

Lock: 40

Lock: 41

No lock: 87

No lock: 87

No lock: 81

No lock: 82

No lock: 52

No lock: 83

No lock: 88

No lock: 88

Lock: 42

No lock: 93

No lock: 91

No lock: 89

No lock: 96

No lock: 88

No lock: 88

Func lock: 57

No lock: 89

No lock: 89

No lock: 97

No lock: 90

No lock: 92

No lock: 94

Lock: 43

Lock: 44

No lock: 89

No lock: 89

No lock: 84

No lock: 53

No lock: 85

No lock: 90

No lock: 90

Lock: 45

No lock: 95

No lock: 93

No lock: 94

No lock: 91

No lock: 98

No lock: 90

No lock: 90

Func lock: 58

No lock: 91

No lock: 91

No lock: 99

No lock: 92

No lock: 95

No lock: 96

Lock: 46

No lock: 91

No lock: 91

No lock: 86

No lock: 87

No lock: 54

No lock: 88

No lock: 92

No lock: 92

Lock: 47

No lock: 97

No lock: 96

No lock: 93

No lock: 92

No lock: 92

Func lock: 59

No lock: 93

No lock: 93

No lock: 94

No lock: 94

No lock: 97

No lock: 98

Lock: 48

No lock: 93

No lock: 93

No lock: 89

No lock: 90

No lock: 55

No lock: 91

No lock: 92

No lock: 93

No lock: 94

No lock: 94

No lock: 95

No lock: 96

No lock: 97

No lock: 98

No lock: 99

Lock: 49

No lock: 99

No lock: 98

No lock: 99

No lock: 95

No lock: 96

No lock: 95

No lock: 94

Func lock: 60

No lock: 95

No lock: 96

No lock: 97

No lock: 98

No lock: 96

No lock: 97

No lock: 97

Lock: 50

No lock: 95

No lock: 94

No lock: 56

No lock: 95

No lock: 96

Lock: 51

No lock: 98

No lock: 99

No lock: 98

No lock: 99

Func lock: 61

Func lock: 62

Func lock: 63

Func lock: 64

Func lock: 65

Func lock: 66

Func lock: 67

No lock: 99

Lock: 52

No lock: 97

No lock: 96

No lock: 97

No lock: 57

No lock: 98

No lock: 99

No lock: 98

Lock: 53

Func lock: 68

Lock: 54

No lock: 99

No lock: 58

Lock: 55

Func lock: 69

Lock: 56

No lock: 59

Lock: 57

Func lock: 70

Lock: 58

No lock: 60

Lock: 59

Func lock: 71

Lock: 60

No lock: 61

Lock: 61

Func lock: 72

Lock: 62

No lock: 62

Lock: 63

Func lock: 73

Lock: 64

No lock: 63

Lock: 65

Func lock: 74

Lock: 66

No lock: 64

Lock: 67

Func lock: 75

Lock: 68

No lock: 65

No lock: 66

Lock: 69

Func lock: 76

Lock: 70

No lock: 67

Lock: 71

Func lock: 77

Lock: 72

No lock: 68

Lock: 73

Func lock: 78

Lock: 74

No lock: 69

Lock: 75

Func lock: 79

Lock: 76

No lock: 70

Lock: 77

Func lock: 80

Lock: 78

No lock: 71

Lock: 79

Func lock: 81

Lock: 80

No lock: 72

Lock: 81

Func lock: 82

Lock: 82

No lock: 73

Lock: 83

Lock: 84

Func lock: 83

Lock: 85

No lock: 74

Lock: 86

Func lock: 84

Lock: 87

No lock: 75

Lock: 88

Func lock: 85

Lock: 89

No lock: 76

No lock: 77

Lock: 90

Func lock: 86

Lock: 91

No lock: 78

Lock: 92

Func lock: 87

Lock: 93

No lock: 79

Lock: 94

Func lock: 88

Lock: 95

No lock: 80

Lock: 96

Func lock: 89

Func lock: 90

Lock: 97

Lock: 98

No lock: 81

Lock: 99

Func lock: 91

Lock: 0

No lock: 82

Lock: 1

Func lock: 92

Lock: 2

Lock: 3

No lock: 83

No lock: 84

Lock: 4

Func lock: 93

Lock: 5

No lock: 85

Lock: 6

Func lock: 94

Lock: 7

No lock: 86

Lock: 8

Func lock: 95

Lock: 9

No lock: 87

No lock: 88

Lock: 10

Lock: 11

Func lock: 96

Lock: 12

No lock: 89

Lock: 13

Func lock: 97

Lock: 14

No lock: 90

Lock: 15

Func lock: 98

Lock: 16

No lock: 91

Lock: 17

Func lock: 99

Lock: 18

Lock: 19

No lock: 92

No lock: 93

Lock: 20

Func lock: 0

Lock: 21

No lock: 94

No lock: 95

No lock: 96

No lock: 97

No lock: 98

Lock: 22

Lock: 23

Func lock: 1

Lock: 24

No lock: 99

Lock: 25

Func lock: 2

Lock: 26

Func lock: 3

Lock: 27

Func lock: 4

Func lock: 5

Func lock: 6

Lock: 28

Func lock: 7

Lock: 29

Func lock: 8

Lock: 30

Func lock: 9

Lock: 31

Lock: 32

Func lock: 10

Lock: 33

Func lock: 11

Lock: 34

Func lock: 12

Lock: 35

Func lock: 13

Lock: 36

Func lock: 14

Lock: 37

Func lock: 15

Lock: 38

Lock: 39

Lock: 40

Func lock: 16

Lock: 41

Func lock: 17

Lock: 42

Func lock: 18

Lock: 43

Func lock: 19

Lock: 44

Func lock: 20

Lock: 45

Func lock: 21

Lock: 46

Func lock: 22

Func lock: 23

Lock: 47

Func lock: 24

Lock: 48

Func lock: 25

Lock: 49

Func lock: 26

Lock: 50

Func lock: 27

Lock: 51

Func lock: 28

Lock: 52

Func lock: 29

Lock: 53

Func lock: 30

Func lock: 31

Lock: 54

Func lock: 32

Lock: 55

Func lock: 33

Lock: 56

Func lock: 34

Lock: 57

Func lock: 35

Lock: 58

Func lock: 36

Lock: 59

Func lock: 37

Lock: 60

Func lock: 38

Func lock: 39

Lock: 61

Func lock: 40

Lock: 62

Func lock: 41

Lock: 63

Func lock: 42

Lock: 64

Func lock: 43

Lock: 65

Func lock: 44

Lock: 66

Func lock: 45

Lock: 67

Lock: 68

Func lock: 46

Lock: 69

Func lock: 47

Lock: 70

Func lock: 48

Lock: 71

Func lock: 49

Lock: 72

Func lock: 50

Lock: 73

Func lock: 51

Lock: 74

Lock: 75

Lock: 76

Func lock: 52

Lock: 77

Func lock: 53

Lock: 78

Func lock: 54

Lock: 79

Func lock: 55

Lock: 80

Func lock: 56

Lock: 81

Func lock: 57

Lock: 82

Func lock: 58

Func lock: 59

Lock: 83

Func lock: 60

Lock: 84

Func lock: 61

Lock: 85

Func lock: 62

Lock: 86

Func lock: 63

Lock: 87

Func lock: 64

Lock: 88

Func lock: 65

Lock: 89

Func lock: 66

Lock: 90

Func lock: 67

Lock: 91

Func lock: 68

Lock: 92

Func lock: 69

Lock: 93

Func lock: 70

Lock: 94

Func lock: 71

Lock: 95

Func lock: 72

Func lock: 73

Lock: 96

Lock: 97

Func lock: 74

Func lock: 75

Lock: 98

Func lock: 76

Lock: 99

Lock: 0

Lock: 1

Func lock: 77

Lock: 2

Func lock: 78

Func lock: 79

Lock: 3

Func lock: 80

Lock: 4

Func lock: 81

Lock: 5

Func lock: 82

Lock: 6

Func lock: 83

Lock: 7

Func lock: 84

Lock: 8

Func lock: 85

Func lock: 86

Lock: 9

Func lock: 87

Lock: 10

Func lock: 88

Lock: 11

Func lock: 89

Lock: 12

Lock: 13

Lock: 14

Lock: 15

Lock: 16

Lock: 17

Lock: 18

Lock: 19

Func lock: 90

Lock: 20

Lock: 21

Func lock: 91

Lock: 22

Func lock: 92

Lock: 23

Lock: 24

Lock: 25

Lock: 26

Lock: 27

Lock: 28

Lock: 29

Lock: 30

Lock: 31

Lock: 32

Lock: 33

Lock: 34

Lock: 35

Lock: 36

Lock: 37

Lock: 38

Lock: 39

Lock: 40

Lock: 41

Lock: 42

Lock: 43

Lock: 44

Lock: 45

Lock: 46

Lock: 47

Lock: 48

Lock: 49

Lock: 50

Lock: 51

Func lock: 93

Lock: 52

Func lock: 94

Lock: 53

Func lock: 95

Lock: 54

Func lock: 96

Lock: 55

Func lock: 97

Lock: 56

Func lock: 98

Func lock: 99

Lock: 57

Lock: 58

Func lock: 0

Func lock: 1

Func lock: 2

Func lock: 3

Func lock: 4

Func lock: 5

Func lock: 6

Func lock: 7

Func lock: 8

Func lock: 9

Func lock: 10

Func lock: 11

Func lock: 12

Func lock: 13

Func lock: 14

Func lock: 15

Func lock: 16

Func lock: 17

Func lock: 18

Func lock: 19

Func lock: 20

Func lock: 21

Func lock: 22

Func lock: 23

Func lock: 24

Func lock: 25

Func lock: 26

Func lock: 27

Func lock: 28

Func lock: 29

Func lock: 30

Func lock: 31

Func lock: 32

Func lock: 33

Func lock: 34

Func lock: 35

Func lock: 36

Func lock: 37

Func lock: 38

Func lock: 39

Func lock: 40

Func lock: 41

Func lock: 42

Func lock: 43

Func lock: 44

Func lock: 45

Func lock: 46

Func lock: 47

Func lock: 48

Func lock: 49

Func lock: 50

Func lock: 51

Func lock: 52

Func lock: 53

Func lock: 54

Func lock: 55

Func lock: 56

Func lock: 57

Func lock: 58

Func lock: 59

Func lock: 60

Func lock: 61

Func lock: 62

Func lock: 63

Func lock: 64

Func lock: 65

Func lock: 66

Func lock: 67

Func lock: 68

Func lock: 69

Func lock: 70

Func lock: 71

Func lock: 72

Func lock: 73

Func lock: 74

Func lock: 75

Func lock: 76

Func lock: 77

Func lock: 78

Func lock: 79

Func lock: 80

Func lock: 81

Func lock: 82

Func lock: 83

Func lock: 84

Func lock: 85

Func lock: 86

Func lock: 87

Func lock: 88

Func lock: 89

Func lock: 90

Func lock: 91

Func lock: 92

Func lock: 93

Func lock: 94

Func lock: 95

Func lock: 96

Func lock: 97

Func lock: 98

Func lock: 99

Func lock: 0

Func lock: 1

Func lock: 2

Func lock: 3

Func lock: 4

Lock: 59

Func lock: 5

Lock: 60

Func lock: 6

Lock: 61

Func lock: 7

Lock: 62

Func lock: 8

Lock: 63

Func lock: 9

Lock: 64

Func lock: 10

Lock: 65

Func lock: 11

Lock: 66

Func lock: 12

Lock: 67

Func lock: 13

Lock: 68

Func lock: 14

Lock: 69

Func lock: 15

Lock: 70

Lock: 71

Lock: 72

Lock: 73

Lock: 74

Lock: 75

Lock: 76

Lock: 77

Lock: 78

Lock: 79

Lock: 80

Lock: 81

Lock: 82

Lock: 83

Lock: 84

Lock: 85

Lock: 86

Lock: 87

Lock: 88

Lock: 89

Lock: 90

Lock: 91

Lock: 92

Lock: 93

Lock: 94

Lock: 95

Lock: 96

Lock: 97

Lock: 98

Lock: 99

Lock: 0

Lock: 1

Lock: 2

Lock: 3

Lock: 4

Lock: 5

Lock: 6

Lock: 7

Lock: 8

Lock: 9

Lock: 10

Lock: 11

Func lock: 16

Lock: 12

Func lock: 17

Lock: 13

Lock: 14

Lock: 15

Lock: 16

Lock: 17

Lock: 18

Lock: 19

Lock: 20

Lock: 21

Lock: 22

Lock: 23

Lock: 24

Lock: 25

Lock: 26

Lock: 27

Lock: 28

Func lock: 18

Lock: 29

Lock: 30

Func lock: 19

Func lock: 20

Func lock: 21

Func lock: 22

Func lock: 23

Func lock: 24

Func lock: 25

Lock: 31

Func lock: 26

Lock: 32

Func lock: 27

Func lock: 28

Lock: 33

Func lock: 29

Lock: 34

Func lock: 30

Lock: 35

Lock: 36

Func lock: 31

Func lock: 32

Lock: 37

Func lock: 33

Lock: 38

Func lock: 34

Lock: 39

Func lock: 35

Lock: 40

Func lock: 36

Lock: 41

Func lock: 37

Lock: 42

Lock: 43

Func lock: 38

Lock: 44

Func lock: 39

Lock: 45

Lock: 46

Func lock: 40

Lock: 47

Lock: 48

Func lock: 41

Lock: 49

Lock: 50

Func lock: 42

Func lock: 43

Lock: 51

Func lock: 44

Lock: 52

Func lock: 45

Lock: 53

Func lock: 46

Func lock: 47

Lock: 54

Lock: 55

Lock: 56

Func lock: 48

Lock: 57

Func lock: 49

Lock: 58

Func lock: 50

Lock: 59

Func lock: 51

Lock: 60

Func lock: 52

Lock: 61

Lock: 62

Func lock: 53

Lock: 63

Func lock: 54

Lock: 64

Func lock: 55

Lock: 65

Func lock: 56

Lock: 66

Func lock: 57

Lock: 67

Func lock: 58

Lock: 68

Func lock: 59

Func lock: 60

Lock: 69

Lock: 70

Func lock: 61

Lock: 71

Func lock: 62

Lock: 72

Func lock: 63

Lock: 73

Func lock: 64

Lock: 74

Func lock: 65

Lock: 75

Lock: 76

Func lock: 66

Lock: 77

Func lock: 67

Lock: 78

Func lock: 68

Lock: 79

Func lock: 69

Lock: 80

Func lock: 70

Lock: 81

Func lock: 71

Lock: 82

Func lock: 72

Func lock: 73

Lock: 83

Func lock: 74

Lock: 84

Func lock: 75

Lock: 85

Func lock: 76

Lock: 86

Func lock: 77

Lock: 87

Func lock: 78

Lock: 88

Func lock: 79

Func lock: 80

Lock: 89

Func lock: 81

Lock: 90

Func lock: 82

Lock: 91

Func lock: 83

Lock: 92

Func lock: 84

Lock: 93

Func lock: 85

Lock: 94

Func lock: 86

Func lock: 87

Lock: 95

Lock: 96

Func lock: 88

Lock: 97

Func lock: 89

Lock: 98

Func lock: 90

Lock: 99

Func lock: 91

Lock: 0

Func lock: 92

Func lock: 93

Lock: 1

Func lock: 94

Func lock: 95

Func lock: 96

Lock: 2

Func lock: 97

Lock: 3

Func lock: 98

Lock: 4

Func lock: 99

Lock: 5

Func lock: 0

Lock: 6

Lock: 7

Func lock: 1

Lock: 8

Func lock: 2

Func lock: 3

Func lock: 4

Func lock: 5

Func lock: 6

Lock: 9

Func lock: 7

Lock: 10

Func lock: 8

Func lock: 9

Func lock: 10

Func lock: 11

Func lock: 12

Func lock: 13

Func lock: 14

Func lock: 15

Func lock: 16

Lock: 11

Func lock: 17

Lock: 12

Lock: 13

Func lock: 18

Func lock: 19

Lock: 14

Func lock: 20

Lock: 15

Func lock: 21

Lock: 16

Func lock: 22

Func lock: 23

Func lock: 24

Func lock: 25

Lock: 17

Func lock: 26

Func lock: 27

Lock: 18

Lock: 19

Lock: 20

Lock: 21

Lock: 22

Lock: 23

Lock: 24

Lock: 25

Lock: 26

Lock: 27

Lock: 28

Lock: 29

Lock: 30

Lock: 31

Lock: 32

Lock: 33

Lock: 34

Lock: 35

Func lock: 28

Lock: 36

Func lock: 29

Lock: 37

Func lock: 30

Lock: 38

Func lock: 31

Lock: 39

Func lock: 32

Lock: 40

Func lock: 33

Lock: 41

Func lock: 34

Lock: 42

Func lock: 35

Lock: 43

Lock: 44

Func lock: 36

Lock: 45

Func lock: 37

Lock: 46

Func lock: 38

Lock: 47

Func lock: 39

Lock: 48

Lock: 49

Func lock: 40

Lock: 50

Lock: 51

Lock: 52

Func lock: 41

Lock: 53

Func lock: 42

Lock: 54

Func lock: 43

Lock: 55

Func lock: 44

Lock: 56

Func lock: 45

Lock: 57

Func lock: 46

Lock: 58

Lock: 59

Lock: 60

Func lock: 47

Lock: 61

Func lock: 48

Lock: 62

Func lock: 49

Lock: 63

Func lock: 50

Lock: 64

Func lock: 51

Lock: 65

Func lock: 52

Lock: 66

Lock: 67

Lock: 68

Func lock: 53

Lock: 69

Func lock: 54

Lock: 70

Func lock: 55

Lock: 71

Func lock: 56

Lock: 72

Func lock: 57

Lock: 73

Func lock: 58

Lock: 74

Lock: 75

Func lock: 59

Lock: 76

Func lock: 60

Lock: 77

Func lock: 61

Lock: 78

Func lock: 62

Lock: 79

Func lock: 63

Lock: 80

Func lock: 64

Lock: 81

Lock: 82

Lock: 83

Func lock: 65

Func lock: 66

Lock: 84

Func lock: 67

Lock: 85

Func lock: 68

Lock: 86

Func lock: 69

Lock: 87

Func lock: 70

Lock: 88

Lock: 89

Func lock: 71

Func lock: 72

Lock: 90

Func lock: 73

Lock: 91

Func lock: 74

Lock: 92

Func lock: 75

Lock: 93

Func lock: 76

Lock: 94

Func lock: 77

Func lock: 78

Lock: 95

Func lock: 79

Lock: 96

Func lock: 80

Lock: 97

Func lock: 81

Lock: 98

Func lock: 82

Lock: 99

Func lock: 83

Lock: 0

Lock: 1

Func lock: 84

Func lock: 85

Lock: 2

Func lock: 86

Lock: 3

Func lock: 87

Lock: 4

Func lock: 88

Lock: 5

Func lock: 89

Lock: 6

Func lock: 90

Func lock: 91

Lock: 7

Func lock: 92

Lock: 8

Func lock: 93

Lock: 9

Func lock: 94

Lock: 10

Func lock: 95

Lock: 11

Func lock: 96

Lock: 12

Lock: 13

Func lock: 97

Func lock: 98

Lock: 14

Func lock: 99

Lock: 15

Lock: 16

Func lock: 0

Lock: 17

Func lock: 1

Lock: 18

Func lock: 2

Func lock: 3

Lock: 19

Func lock: 4

Lock: 20

Func lock: 5

Lock: 21

Func lock: 6

Lock: 22

Func lock: 7

Lock: 23

Func lock: 8

Func lock: 9

Lock: 24

Func lock: 10

Func lock: 11

Func lock: 12

Lock: 25

Func lock: 13

Lock: 26

Func lock: 14

Lock: 27

Func lock: 15

Lock: 28

Func lock: 16

Lock: 29

Func lock: 17

Func lock: 18

Lock: 30

Func lock: 19

Lock: 31

Func lock: 20

Lock: 32

Func lock: 21

Lock: 33

Func lock: 22

Lock: 34

Func lock: 23

Lock: 35

Func lock: 24

Lock: 36

Func lock: 25

Func lock: 26

Func lock: 27

Func lock: 28

Func lock: 29

Func lock: 30

Lock: 37

Lock: 38

Func lock: 31

Lock: 39

Func lock: 32

Lock: 40

Func lock: 33

Lock: 41

Func lock: 34

Lock: 42

Lock: 43

Func lock: 35

Lock: 44

Func lock: 36

Lock: 45

Func lock: 37

Lock: 46

Func lock: 38

Lock: 47

Func lock: 39

Lock: 48

Func lock: 40

Lock: 49

Func lock: 41

Func lock: 42

Lock: 50

Func lock: 43

Lock: 51

Func lock: 44

Lock: 52

Func lock: 45

Lock: 53

Func lock: 46

Lock: 54

Func lock: 47

Lock: 55

Func lock: 48

Func lock: 49

Lock: 56

Func lock: 50

Func lock: 51

Func lock: 52

Func lock: 53

Func lock: 54

Func lock: 55

Func lock: 56

Func lock: 57

Func lock: 58

Func lock: 59

Lock: 57

Func lock: 60

Lock: 58

Lock: 59

Func lock: 61

Lock: 60

Func lock: 62

Lock: 61

Func lock: 63

Lock: 62

Func lock: 64

Lock: 63

Func lock: 65

Lock: 64

Func lock: 66

Lock: 65

Lock: 66

Func lock: 67

Lock: 67

Func lock: 68

Lock: 68

Func lock: 69

Lock: 69

Func lock: 70

Lock: 70

Func lock: 71

Lock: 71

Func lock: 72

Lock: 72

Lock: 73

Func lock: 73

Lock: 74

Func lock: 74

Lock: 75

Func lock: 75

Lock: 76

Func lock: 76

Lock: 77

Func lock: 77

Lock: 78

Func lock: 78

Lock: 79

Lock: 80

Func lock: 79

Func lock: 80

Lock: 81

Func lock: 81

Lock: 82

Func lock: 82

Func lock: 83

Lock: 83

Lock: 84

Lock: 85

Lock: 86

Lock: 87

Lock: 88

Lock: 89

Lock: 90

Lock: 91

Func lock: 84

Func lock: 85

Func lock: 86

Func lock: 87

Func lock: 88

Func lock: 89

Func lock: 90

Func lock: 91

Func lock: 92

Func lock: 93

Func lock: 94

Func lock: 95

Func lock: 96

Func lock: 97

Func lock: 98

Func lock: 99

Func lock: 0

Func lock: 1

Func lock: 2

Func lock: 3

Func lock: 4

Func lock: 5

Func lock: 6

Func lock: 7

Func lock: 8

Func lock: 9

Func lock: 10

Func lock: 11

Func lock: 12

Func lock: 13

Func lock: 14

Func lock: 15

Func lock: 16

Func lock: 17

Func lock: 18

Func lock: 19

Func lock: 20

Func lock: 21

Func lock: 22

Func lock: 23

Func lock: 24

Func lock: 25

Func lock: 26

Func lock: 27

Func lock: 28

Func lock: 29

Func lock: 30

Func lock: 31

Func lock: 32

Func lock: 33

Func lock: 34

Func lock: 35

Func lock: 36

Func lock: 37

Func lock: 38

Func lock: 39

Func lock: 40

Func lock: 41

Func lock: 42

Func lock: 43

Func lock: 44

Func lock: 45

Func lock: 46

Func lock: 47

Func lock: 48

Func lock: 49

Func lock: 50

Func lock: 51

Func lock: 52

Func lock: 53

Func lock: 54

Func lock: 55

Func lock: 56

Func lock: 57

Func lock: 58

Func lock: 59

Func lock: 60

Func lock: 61

Func lock: 62

Func lock: 63

Func lock: 64

Func lock: 65

Func lock: 66

Func lock: 67

Func lock: 68

Func lock: 69

Func lock: 70

Func lock: 71

Func lock: 72

Func lock: 73

Func lock: 74

Func lock: 75

Lock: 92

Lock: 93

Lock: 94

Lock: 95

Lock: 96

Lock: 97

Lock: 98

Lock: 99

Func lock: 76

Func lock: 77

Func lock: 78

Func lock: 79

Func lock: 80

Func lock: 81

Func lock: 82

Func lock: 83

Func lock: 84

Func lock: 85

Func lock: 86

Func lock: 87

Func lock: 88

Func lock: 89

Func lock: 90

Func lock: 91

Func lock: 92

Func lock: 93

Func lock: 94

Func lock: 95

Func lock: 96

Func lock: 97

Func lock: 98

Func lock: 99

Func lock: 0

Func lock: 1

Func lock: 2

Func lock: 3

Func lock: 4

Func lock: 5

Func lock: 6

Func lock: 7

Func lock: 8

Func lock: 9

Func lock: 10

Func lock: 11

Func lock: 12

Func lock: 13

Func lock: 14

Func lock: 15

Func lock: 16

Func lock: 17

Func lock: 18

Func lock: 19

Func lock: 20

Func lock: 21

Func lock: 22

Func lock: 23

Func lock: 24

Func lock: 25

Func lock: 26

Func lock: 27

Func lock: 28

Func lock: 29

Func lock: 30

Func lock: 31

Func lock: 32

Func lock: 33

Func lock: 34

Func lock: 35

Func lock: 36

Func lock: 37

Func lock: 38

Func lock: 39

Func lock: 40

Func lock: 41

Func lock: 42

Func lock: 43

Func lock: 44

Func lock: 45

Func lock: 46

Func lock: 47

Func lock: 48

Func lock: 49

Func lock: 50

Func lock: 51

Func lock: 52

Func lock: 53

Func lock: 54

Func lock: 55

Func lock: 56

Func lock: 57

Func lock: 58

Func lock: 59

Func lock: 60

Func lock: 61

Func lock: 62

Func lock: 63

Func lock: 64

Func lock: 65

Func lock: 66

Func lock: 67

Func lock: 68

Func lock: 69

Func lock: 70

Func lock: 71

Func lock: 72

Func lock: 73

Func lock: 74

Func lock: 75

Func lock: 76

Func lock: 77

Func lock: 78

Func lock: 79

Func lock: 80

Func lock: 81

Func lock: 82

Func lock: 83

Func lock: 84

Func lock: 85

Func lock: 86

Func lock: 87

Func lock: 88

Func lock: 89

Func lock: 90

Func lock: 91

Func lock: 92

Func lock: 93

Func lock: 94

Func lock: 95

Func lock: 96

Func lock: 97

Func lock: 98

Func lock: 99

Lock: 0

Func lock: 0

Func lock: 1

Func lock: 2

Func lock: 3

Func lock: 4

Func lock: 5

Func lock: 6

Func lock: 7

Func lock: 8

Func lock: 9

Func lock: 10

Func lock: 11

Func lock: 12

Func lock: 13

Func lock: 14

Func lock: 15

Func lock: 16

Func lock: 17

Func lock: 18

Func lock: 19

Func lock: 20

Func lock: 21

Func lock: 22

Func lock: 23

Func lock: 24

Func lock: 25

Func lock: 26

Func lock: 27

Func lock: 28

Func lock: 29

Func lock: 30

Func lock: 31

Func lock: 32

Func lock: 33

Func lock: 34

Func lock: 35

Lock: 1

Func lock: 36

Lock: 2

Func lock: 37

Func lock: 38

Func lock: 39

Func lock: 40

Func lock: 41

Func lock: 42

Func lock: 43

Func lock: 44

Func lock: 45

Func lock: 46

Func lock: 47

Func lock: 48

Func lock: 49

Func lock: 50

Func lock: 51

Func lock: 52

Func lock: 53

Func lock: 54

Func lock: 55

Func lock: 56

Func lock: 57

Func lock: 58

Func lock: 59

Func lock: 60

Func lock: 61

Func lock: 62

Func lock: 63

Func lock: 64

Func lock: 65

Func lock: 66

Func lock: 67

Func lock: 68

Func lock: 69

Func lock: 70

Func lock: 71

Func lock: 72

Func lock: 73

Func lock: 74

Func lock: 75

Func lock: 76

Func lock: 77

Func lock: 78

Func lock: 79

Func lock: 80

Func lock: 81

Func lock: 82

Func lock: 83

Func lock: 84

Func lock: 85

Func lock: 86

Func lock: 87

Func lock: 88

Func lock: 89

Func lock: 90

Func lock: 91

Func lock: 92

Func lock: 93

Func lock: 94

Func lock: 95

Func lock: 96

Func lock: 97

Func lock: 98

Func lock: 99

Lock: 3

Func lock: 0

Lock: 4

Lock: 5

Func lock: 1

Lock: 6

Func lock: 2

Func lock: 3

Lock: 7

Func lock: 4

Lock: 8

Func lock: 5

Lock: 9

Func lock: 6

Lock: 10

Func lock: 7

Lock: 11

Func lock: 8

Lock: 12

Func lock: 9

Lock: 13

Func lock: 10

Func lock: 11

Func lock: 12

Func lock: 13

Func lock: 14

Func lock: 15

Lock: 14

Func lock: 16

Func lock: 17

Lock: 15

Func lock: 18

Lock: 16

Lock: 17

Lock: 18

Lock: 19

Func lock: 19

Lock: 20

Func lock: 20

Func lock: 21

Lock: 21

Func lock: 22

Lock: 22

Func lock: 23

Lock: 23

Func lock: 24

Lock: 24

Func lock: 25

Lock: 25

Func lock: 26

Lock: 26

Func lock: 27

Func lock: 28

Lock: 27

Func lock: 29

Lock: 28

Func lock: 30

Lock: 29

Func lock: 31

Lock: 30

Func lock: 32

Lock: 31

Func lock: 33

Lock: 32

Func lock: 34

Func lock: 35

Lock: 33

Func lock: 36

Lock: 34

Func lock: 37

Lock: 35

Func lock: 38

Lock: 36

Func lock: 39

Lock: 37

Func lock: 40

Lock: 38

Func lock: 41

Func lock: 42

Lock: 39

Func lock: 43

Lock: 40

Func lock: 44

Lock: 41

Func lock: 45

Lock: 42

Func lock: 46

Lock: 43

Func lock: 47

Lock: 44

Func lock: 48

Lock: 45

Func lock: 49

Lock: 46

Func lock: 50

Lock: 47

Func lock: 51

Lock: 48

Func lock: 52

Lock: 49

Func lock: 53

Lock: 50

Func lock: 54

Func lock: 55

Lock: 51

Func lock: 56

Lock: 52

Func lock: 57

Lock: 53

Func lock: 58

Lock: 54

Lock: 55

Lock: 56

Lock: 57

Lock: 58

Lock: 59

Func lock: 59

Lock: 60

Lock: 61

Lock: 62

Lock: 63

Lock: 64

Func lock: 60

Func lock: 61

Lock: 65

Lock: 66

Func lock: 62

Lock: 67

Lock: 68

Func lock: 63

Lock: 69

Func lock: 64

Lock: 70

Func lock: 65

Func lock: 66

Func lock: 67

Lock: 71

Func lock: 68

Lock: 72

Func lock: 69

Lock: 73

Func lock: 70

Lock: 74

Func lock: 71

Lock: 75

Func lock: 72

Lock: 76

Func lock: 73

Func lock: 74

Func lock: 75

Func lock: 76

Func lock: 77

Lock: 77

Func lock: 78

Lock: 78

Func lock: 79

Lock: 79

Func lock: 80

Func lock: 81

Func lock: 82

Func lock: 83

Func lock: 84

Func lock: 85

Func lock: 86

Func lock: 87

Func lock: 88

Func lock: 89

Func lock: 90

Func lock: 91

Lock: 80

Lock: 81

Func lock: 92

Func lock: 93

Lock: 82

Func lock: 94

Lock: 83

Lock: 84

Func lock: 95

Lock: 85

Func lock: 96

Lock: 86

Func lock: 97

Lock: 87

Func lock: 98

Lock: 88

Func lock: 99

Lock: 89

Lock: 90

Lock: 91

Lock: 92

Lock: 93

Lock: 94

Lock: 95

Lock: 96

Lock: 97

Lock: 98

Lock: 99

Lock: 0

Lock: 1

Lock: 2

Lock: 3

Lock: 4

Lock: 5

Lock: 6

Lock: 7

Lock: 8

Lock: 9

Lock: 10

Lock: 11

Lock: 12

Lock: 13

Lock: 14

Lock: 15

Lock: 16

Lock: 17

Lock: 18

Lock: 19

Lock: 20

Lock: 21

Lock: 22

Lock: 23

Lock: 24

Lock: 25

Lock: 26

Lock: 27

Lock: 28

Lock: 29

Lock: 30

Lock: 31

Lock: 32

Lock: 33

Lock: 34

Lock: 35

Lock: 36

Lock: 37

Lock: 38

Lock: 39

Lock: 40

Lock: 41

Lock: 42

Lock: 43

Lock: 44

Lock: 45

Lock: 46

Lock: 47

Lock: 48

Lock: 49

Lock: 50

Lock: 51

Lock: 52

Lock: 53

Lock: 54

Lock: 55

Lock: 56

Lock: 57

Lock: 58

Lock: 59

Lock: 60

Lock: 61

Lock: 62

Lock: 63

Lock: 64

Lock: 65

Lock: 66

Lock: 67

Lock: 68

Lock: 69

Lock: 70

Lock: 71

Lock: 72

Lock: 73

Lock: 74

Lock: 75

Lock: 76

Lock: 77

Lock: 78

Lock: 79

Lock: 80

Lock: 81

Lock: 82

Lock: 83

Lock: 84

Lock: 85

Lock: 86

Lock: 87

Lock: 88

Lock: 89

Lock: 90

Lock: 91

Lock: 92

Lock: 93

Lock: 94

Lock: 95

Lock: 96

Lock: 97

Lock: 98

Lock: 99

Lock: 0

Lock: 1

Lock: 2

Lock: 3

Lock: 4

Lock: 5

Lock: 6

Lock: 7

Lock: 8

Lock: 9

Lock: 10

Lock: 11

Lock: 12

Lock: 13

Lock: 14

Lock: 15

Lock: 16

Lock: 17

Lock: 18

Lock: 19

Lock: 20

Lock: 21

Lock: 22

Lock: 23

Lock: 24

Lock: 25

Lock: 26

Lock: 27

Lock: 28

Lock: 29

Lock: 30

Lock: 31

Lock: 32

Lock: 33

Lock: 34

Lock: 35

Lock: 36

Lock: 37

Lock: 38

Lock: 39

Lock: 40

Lock: 41

Lock: 42

Lock: 43

Lock: 44

Lock: 45

Lock: 46

Lock: 47

Lock: 48

Lock: 49

Lock: 50

Lock: 51

Lock: 52

Lock: 53

Lock: 54

Lock: 55

Lock: 56

Lock: 57

Lock: 58

Lock: 59

Lock: 60

Lock: 61

Lock: 62

Lock: 63

Lock: 64

Lock: 65

Lock: 66

Lock: 67

Lock: 68

Lock: 69

Lock: 70

Lock: 71

Lock: 72

Lock: 73

Lock: 74

Lock: 75

Lock: 76

Lock: 77

Lock: 78

Lock: 79

Lock: 80

Lock: 81

Lock: 82

Lock: 83

Lock: 84

Lock: 85

Lock: 86

Lock: 87

Lock: 88

Lock: 89

Lock: 90

Lock: 91

Lock: 92

Lock: 93

Lock: 94

Lock: 95

Lock: 96

Lock: 97

Lock: 98

Lock: 99

参考网址:http://www.kankanews.com/ICkengine/archives/19105.shtml

时间: 10-11

synchronized与static synchronized 的区别、synchronized在JVM底层的实现原理及Java多线程锁理解的相关文章

synchronized与static synchronized 的差别、synchronized在JVM底层的实现原理及Java多线程锁理解

本Blog分为例如以下部分: 第一部分:synchronized与static synchronized 的差别 第二部分:JVM底层又是怎样实现synchronized的 第三部分:Java多线程锁,源码剖析 第一部分:synchronized与static synchronized的差别 1.synchronized与static synchronized 的差别 synchronized是对类的当前实例进行加锁,防止其它线程同一时候訪问该类的该实例的全部synchronized块.注意这里

详解Java多线程锁之synchronized

synchronized是Java中解决并发问题的一种最常用的方法,也是最简单的一种方法. synchronized的四种使用方式 修饰代码块:被修饰的代码块称为同步语句块,其作用的范围是大括号{}括起来的代码,作用于调用对象 修饰方法:被修饰的方法称为同步方法,其作用的范围是整个方法,作用于调用对象 注意:synchronized修饰方法时必须是显式调用,如果没有显式调用,例如子类重写该方法时没有显式加上synchronized,则不会有加锁效果. 修饰静态方法:其作用的范围是整个静态方法,作

JAVA多线程之深入研究 Java Synchronize 和 Lock 的区别与用法

在分布式开发中,锁是线程控制的重要途径.Java为此也提供了2种锁机制,synchronized和lock.做为Java爱好者,自然少不了对比一下这2种机制,也能从中学到些分布式开发需要注意的地方. 我们先从最简单的入手,逐步分析这2种的区别. 一.synchronized和lock的用法区别 synchronized:在需要同步的对象中加入此控制,synchronized可以加在方法上,也可以加在特定代码块中,括号中表示需要锁的对象. lock:需要显示指定起始位置和终止位置.一般使用Reen

synchronized与static synchronized 的区别

1.synchronized与static synchronized 的区别 synchronized是对类的当前实例进行加锁,防止其他线程同时访问该类的该实例的所有synchronized块,注意这里是"类的当前实例", 类的两个不同实例就没有这种约束了.那么static synchronized恰好就是要控制类的所有实例的访问了,static synchronized是限制线程同时访问jvm中该类的所有实例同时访问对应的代码快.实际上,在类中某方法或某代码块中有 synchroni

synchronized 修饰在 static方法和非static方法的区别

Java中synchronized用在静态方法和非静态方法上面的区别 在Java中,synchronized是用来表示同步的,我们可以synchronized来修饰一个方法.也可以synchronized来修饰方法里面的一个语句块.那么,在static方法和非static方法前面加synchronized到底有什么不同呢?大家都知道,static的方法属于类方法,它属于这个Class(注意:这里的Class不是指Class的某个具体对象),那么static获取到的锁,是属于类的锁.而非stati

Synchronized和Static Synchronized区别

通过分析这两个用法的分析,我们可以理解java中锁的概念.一个是实例锁(锁在某一个实例对象上,如果该类是单例,那么该锁也具有全局锁的概念),一个是全局锁(该锁针对的是类,无论实例多少个对象,那么线程都共享该锁).实例锁对应的就是synchronized关键字,而类锁(全局锁)对应的就是static synchronized(或者是锁在该类的class或者classloader对象上).下面的文章做了很好的总结: ? 1.synchronized与static synchronized 的区别 ?

Java语言中synchronized 修饰在 static方法和 非static方法的区别(转)

synchronized锁住的是对象,当初始化对象的时候,JVM在对象初始化完成之前会调用方法外面的语句块,这个时候对象还不存在,所以就不存在锁了. 那么,在static方法和非static方法前面加synchronized到底有什么不同呢? 大家都知道,static的方法属于类方法,它属于这个Class(注意:这里的Class不是指Class的某个具体对象),那么static获取到的锁,就是当前调用这个方法的对象所属的类(Class,而不再是由这个Class产生的某个具体对象了).而非stat

java synchronized和(ReentrantLock)区别

原文:http://blog.csdn.net/zheng548/article/details/54426947 区别一:API层面 syschronized使用 synchronized即可修饰方法,也可以修饰代码块. synchronized修饰方法时,如下所示: //synchronized修饰一个方法时,这个方法叫同步方法 public synchronized void test(){ //方法体 } synchronized修饰代码块时,包涵两部分:锁对象的引用和这个锁保护的代码块

Java面试之synchronized 和 static synchronized

?面试题: 答案: 不能 不能 不能 不能 能 正文 概述 通过分析这两个用法的分析,我们可以理解java中锁的概念.一个是实例锁(锁在某一个实例对象上,如果该类是单例,那么该锁也具有全局锁的概念),一个是全局锁(该锁针对的是类,无论实例多少个对象,那么线程都共享该锁).实例锁对应的就是synchronized关键字,而类锁(全局锁)对应的就是static synchronized(或者是锁在该类的class或者classloader对象上). 区别 synchronized关键字 synchr