synchronized知识梳理

用户态与内核态

JDK早期,synchronized 叫做重量级锁, 因为申请锁资源必须通过kernel, 系统调用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
;hello.asm
;write(int fd, const void *buffer, size_t nbytes)

section data
msg db "Hello", 0xA
len equ $ - msg

section .text
global _start
_start:

mov edx, len
mov ecx, msg
mov ebx, 1 ;文件描述符1 std_out
mov eax, 4 ;write函数系统调用号 4
int 0x80

mov ebx, 0
mov eax, 1 ;exit函数系统调用号
int 0x80

HashMap知识梳理

一文读懂HashMap

本文准备从以下几个方面去讲解HashMap:
1)HashMap源码详细分析
2)HashMap为什么是线程不安全的?
3)1.7和1.8的HashMap实现区别总结
4)HashMap和HashTable的区别

HashMap源码分析

一、构造函数

让我们先从构造函数说起,HashMap有四个构造方法,别慌

1.1 HashMap()

// 1.无参构造方法、
// 构造一个空的HashMap,初始容量为16,负载因子为0.75
public HashMap() {
    this.loadFactor = DEFAULT_LOAD_FACTOR; // all other fields defaulted
}

:D 一言句子获取中...