Skip to content

Commit a8eeaf5

Browse files
committed
更新
1 parent 21e77e0 commit a8eeaf5

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

MD/ConcurrentHashMap.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
## 数据结构
88
![](https://ws2.sinaimg.cn/large/006tNc79ly1fn2f5pgxinj30dw0730t7.jpg)
99

10-
如图所示,是由 Segment 数组,以及 `HashEntry` 数组组成,和 HashMap 一样,仍然是数组加链表组成。
10+
如图所示,是由 `Segment` 数组`HashEntry` 数组组成,和 `HashMap` 一样,仍然是数组加链表组成。
1111

12-
`ConcurrentHashMap` 采用了分段锁技术,其中 `Segment` 继承于 `ReentrantLock`。不会像 `HashTable` 那样不管是 `put` 还是 `get` 操作都需要做同步处理,理论上 ConcurrentHashMap 支持 `CurrencyLevel` (Segment数组数量)的线程并发。每当一个线程占用锁访问一个 `Segment` 时,不会影响到其他的 `Segment`
12+
`ConcurrentHashMap` 采用了分段锁技术,其中 `Segment` 继承于 `ReentrantLock`。不会像 `HashTable` 那样不管是 `put` 还是 `get` 操作都需要做同步处理,理论上 ConcurrentHashMap 支持 `CurrencyLevel` (Segment 数组数量)的线程并发。每当一个线程占用锁访问一个 `Segment` 时,不会影响到其他的 `Segment`
1313

1414
## get 方法
1515
ConcurrentHashMap 的 get 方法是非常高效的,因为整个过程都不需要加锁。

0 commit comments

Comments
 (0)