Skip to content

Instantly share code, notes, and snippets.

View jvm内存模型
jvm内存模型
---JMM就是java解决多线程下内存共享的一个模型,与内存分区管理是不同的层面!
根据线程私有和线程共享来看:
线程私有:
---程序计数器:如果正在执行Java方法,则指向虚拟机字节码指令的地址,如果是native的,这个计算器的值为空。
---虚拟机栈:保存本地变量、操作数栈、动态链接、方法出口等信息。为执行java方法服务。
View lock
自旋锁
自适应自旋
锁消除 (eg 方法体内)
锁粗化
轻量级锁 (CAS)
偏向锁
View back.html
<html>
<div id="header">
<a href="javascript:document.getElementById('my_iframe').contentWindow.history.back();" target="iframe">返回</a>
</div>
<div id="main">
<iframe id="my_iframe">内容</iframe>
</div>
</html>
View validate.addmethod.js
var vcity={ 11:"北京",12:"天津",13:"河北",14:"山西",15:"内蒙古",
21:"辽宁",22:"吉林",23:"黑龙江",31:"上海",32:"江苏",
33:"浙江",34:"安徽",35:"福建",36:"江西",37:"山东",41:"河南",
42:"湖北",43:"湖南",44:"广东",45:"广西",46:"海南",50:"重庆",
51:"四川",52:"贵州",53:"云南",54:"西藏",61:"陕西",62:"甘肃",
63:"青海",64:"宁夏",65:"新疆",71:"台湾",81:"香港",82:"澳门",91:"国外"
};
isIdCardNo = function(card)
{
@doubledouble
doubledouble / ALG.java
Last active Dec 14, 2015
插入排序,归并排序
View ALG.java
package test.algorithm;
import java.util.Arrays;
/**
* from wiki http://zh.wikipedia.org/wiki/插入排序
* http://zh.wikipedia.org/wiki/归并排序
**/
public class ALG {
@doubledouble
doubledouble / SynchronizedTest.java
Created Mar 4, 2013
SynchronizedTest 4个线程 2个加一,2个减一
View SynchronizedTest.java
package test;
public class SynchronizedTest {
public static void main(String[] args) {
J j = new J();
Thread inc1 = new Thread(new IncrementThread(j), "inc1");
Thread inc2 = new Thread(new IncrementThread(j), "inc2");
Thread dec1 = new Thread(new DecrementThread(j), "dec1");
Thread dec2 = new Thread(new DecrementThread(j), "dec2");
@doubledouble
doubledouble / LoaderTest.java
Last active Dec 14, 2015
Java父类子类加载
View LoaderTest.java
package test;
/**
*
* @author Administrator
*
*/
public class LoaderTest {
View builder模式.md
View shortcut.md
@doubledouble
doubledouble / linux 网卡.md
Last active Dec 14, 2015
centos 网卡相关问题
View linux 网卡.md