`

线程笔记

    博客分类:
  • java
阅读更多

Chapter 20 of Inside the Java Virtual Machine
Thread Synchronization

 

 

 

1.Java's monitor supports two kinds of thread synchronization: mutual exclusion and cooperation.

 

2.. On a Java virtual machine implementation that doesn't time slice, however, a higher priority thread that is never blocked will interfere with any lower priority threads, even if none of the threads share data.

 

3.The form of monitor used by the Java virtual machine is called a "Wait and Notify" monitor.

 

4.monitor 模型

 

 

5.The Java virtual machine offers two kinds of notify commands: "notify" and "notify all." A notify command selects one thread arbitrarily from the wait set and marks it for eventual resurrection. A notify all command marks all threads currently in the wait set for eventual resurrection.

 

6.To a great extent, the manner in which a Java virtual machine implementation selects the next thread from the wait or entry sets is a decision of individual implementation designers.平台不同性

 

 

7.Java programs need to coordinate multi-threaded access to two kinds of data: o instance variables, which are stored on the heap o class variables, which are stored in the method area Programs never need to coordinate access to local variables, which reside on Java stacks, because data on the Java stack is private to the thread to which the Java stack belongs.

 

 

8. In Java, there are two kinds of monitor regions: synchronized statements and synchronized methods.

 

9.Note that as a Java programmer, you never explicitly lock an object. Object locks are internal to the Java virtual machine

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics