java多线程编程实战指南(设计模式篇) 第2版 编程语言 黄文海 正版pdf下载

java多线程编程实战指南(设计模式篇) 第2版 编程语言 黄文海 正版百度网盘pdf下载

作者:
简介:java多线程编程实战指南(设计模式篇) 第2版 编程语言 黄文海 正版
出版社:
出版时间:2020-03
pdf下载价格:0.00¥

免费下载


书籍下载


内容介绍

基本信息
书名: java多线程编程实战指南(设计模式篇) 第2版 ISBN号: 9787121382451
作者: 黄文海 页数: 280
定价: 69.00元 出版时间: 2020-03-01
装帧: 平装 印刷时间:
出版社: 电子工业出版社 版次: 2
开本: 16开 字数: 403000

目录

章 java多线程编程实战基础 1
1.1 无处不在的线程 1
1.2 线程的创建与运行 3
1.3 线程的状态与上下文切换 5
1.4 对线程的监视 8
1.5 原子性、内存可见性和重排序――重新认识synchronized和volatile 11
1.6 多线程编程的优势和风险 13
1.7 多线程编程常用术语 14
第2章 设计模式简介 19
2.1 设计模式及其作用 19
2.2 多线程设计模式简介 22
2.3 设计模式的描述 23
第3章 immutable object(不可变对象)模式 25
3.1 immutable object模式简介 25
3.2 immutable object模式的架构 27
3.3 immutable object模式实战案例解析 29
3.4 immutable object模式的评价与实现考量 33
3.4.1 适用场景 33
3.4.2 对垃圾回收(garbage collection)的影响 34
3.4.3 使用等效或者似的不可变对象 35
3.4.4 防御性复制 35
3.5 immutable object模式的可复用实现代码 35
3.6 java标准库实例 35
3.7 相关模式 37
3.7.1 thread specific storage模式(0章) 37
3.7.2 serial thread confinement模式(1章) 37
3.8 参考资源 38
第4章 guarded suspension(保护性暂挂)模式 39
4.1 guarded suspension模式简介 39
4.2 guarded suspension模式的架构 39
4.3 guarded suspension模式实战案例解析 43
4.4 guarded suspension模式的评价与实现考量 50
4.4.1 内存可见性和锁泄漏(lock leak) 51
4.4.2 线程被过早地唤醒 52
4.4.3 嵌套监视器锁死 53
4.5 guarded suspension模式的可复用实现代码 56
4.6 java标准库实例 56
4.7 相关模式 56
4.7.1 promise模式(第6章) 57
4.7.2 producer-consumer模式(第7章) 57
4.8 参考资源 57
第5章 two-phase termination(两阶段终止)模式 58
5.1 two-phase termination模式简介 58
5.2 two-phase termination模式的架构 59
5.3 two-phase termination模式实战案例解析 61
5.4 two-phase termination模式的评价与实现考量 70
5.4.1 线程停止标志 71
5.4.2 生产者/消费者问题中的线程停止 71
5.4.3 隐藏而非暴可停止线程 73
5.5 two-phase termination模式的可复用实现代码 73
5.6 java标准库实例 73
5.7 相关模式 74
5.7.1 producer-consumer模式(第7章) 74
5.7.2 master-slave模式(2章) 74
5.8 参考资源 74
第6章 promise(承诺)模式 75
6.1 promise模式简介 75
6.2 promise模式的架构 75
6.3 promise模式实战案例解析 78
6.4 promise模式的评价与实现考量 81
6.4.1 异步方的异常处理 82
6.4.2 轮询 82
6.4.3 异步任务的执行 83
6.5 promise模式的可复用实现代码 84
6.6 java标准库实例 85
6.7 相关模式 85
6.7.1 guarded suspension模式(第4章) 85
6.7.2 active object模式(第8章) 86
6.7.3 master-slave模式(2章) 86
6.7.4 factory method(工厂方)模式 86
6.8 参考资源 86
第7章 producer-consumer(生产者/消费者)模式 87
7.1 producer-consumer模式简介 87
7.2 producer-consumer模式的架构 87
7.3 producer-consumer模式实战案例解析 90
7.4 producer-consumer模式的评价与实现考量 93
7.4.1 产品的粒度 94
7.4.2 通道积压 94
7.4.3 非阻塞式反压与reactive streams规范 96
7.4.4 工作取算 97
7.4.5 线程的停止 101
7.4.6 高性能、高可靠性的producer-consumer模式实现 101
7.5 producer-consumer模式的可复用实现代码 102
7.6 java标准库实例 102
7.7 相关模式 102
7.7.1 guarded suspension模式(第4章) 102
7.7.2 thread pool模式(第9章) 103
7.8 参考资源 103
第8章 active object(主动对象)模式 104
8.1 active object模式简介 104
8.2 active object模式的架构 105
8.3 active object模式实战案例解析 108
8.4 active object模式的评价与实现考量 115
8.4.1 错误隔离 117
8.4.2 缓冲区监控 118
8.4.3 缓冲区饱和处理策略 118
8.4.4 scheduler空闲工作者线程清理 119
8.5 active object模式的可复用实现代码 119
8.6 java标准库实例 123
8.7 相关模式 123
8.7.1 promise模式(第6章) 123
8.7.2 producer-consumer模式(第7章) 123
8.8 参考资源 124
第9章 thread pool(线程池)模式 125
9.1 thread pool模式简介 125
9.2 thread pool模式的架构 126
9.3 thread pool模式实战案例解析 128
9.4 thread pool模式的评价与实现考量 130
9.4.1 工作队列的选择 131
9.4.2 线程池大小调校 132
9.4.3 线程池监控 134
9.4.4 线程泄漏 135
9.4.5 可靠性与线程池饱和处理策略 135
9.4.6 死锁 138
9.4.7 线程池空闲线程清理 139
9.5 thread pool模式的可复用实现代码 140
9.6 java标准库实例 140
9.7 相关模式 140
9.7.1 two-phase termination模式(第5章) 140
9.7.2 promise模式(第6章) 141
9.7.3 producer-consumer模式(第7章) 141
9.8 参考资源 141
0章 thread specific storage(线程特有存储)模式 142
10.1 thread specific storage模式简介 142
10.2 thread specific storage模式的架构 144
10.3 thread specific storage模式实战案例解析 146
10.4 thread specific storage模式的评价与实现考量 149
10.4.1 在线程池环境下使用thread specific storage模式 153
10.4.2 内存泄漏与伪内存泄漏 153
10.5 thread specific storage模式的可复用实现代码 161
10.6 java标准库实例 161
10.7 相关模式 162
10.7.1 immutable object模式(第3章) 162
10.7.2 proxy(代理)模式 162
10.7.3 singleton(单例)模式 162
10.8 参考资源 162
1章 serial thread confinement(串行线程封闭)模式 163
11.1 serial thread confinement模式简介 163
11.2 serial thread confinement模式的架构 163
11.3 serial thread confinement模式实战案例解析 166
11.4 serial thread confinement模式的评价与实现考量 170
11.5 serial thread confinement模式的可复用实现代码 171
11.6 java标准库实例 176
11.7 相关模式 177
11.7.1 immutable object模式(第3章) 177
11.7.2 promise模式(第6章) 177
11.7.3 producer-consumer模式(第7章) 177
11.7.4 thread specific storage模式(0章) 177
11.8 参考资源 177
2章 master-slave(主仆)模式 178
12.1 master-slave模式简介 178
12.2 master-slave模式的架构 178
12.3 master-slave模式实战案例解析 180
12.4 master-slave模式的评价与实现考量 187
12.4.1 子任务处理结果的收集 188
12.4.2 slave参与者实例的负载均衡与工作取 189
12.4.3 可靠性与异常处理 190
12.4.4 slave线程的停止 190
12.5 master-slave模式的可复用实现代码 190
12.6 java标准库实例 204
12.7 相关模式 204
12.7.1 two-phase termination模式(第5章) 204
12.7.2 promise模式(第6章) 204
12.7.3 strategy(策略)模式 204
12.7.4 template(模板)模式 205
12.7.5 factory method(工厂方)模式 205
12.8 参考资源 205
3章 pipeline(流水线)模式 206
13.1 pipeline模式简介 206
13.2 pipeline模式的架构 207
13.3 pipeline模式实战案例解析 212
13.4 pipeline模式的评价与实现考量 219
13.4.1 pipeline的深度 220
13.4.2 基于线程池的pipe 220
13.4.3 错误处理 223
13.4.4 可配置的pipeline 224
13.5 pipeline模式的可复用实现代码 224
13.6 java标准库实例 236
13.7 相关模式 236
13.7.1 serial thread confinement模式(1章) 236
13.7.2 master-slave模式(2章) 237
13.7.3 ite模式 237
13.8 参考资源 237
4章 half-sync/half-async(半同步/半异步)模式 238
14.1 half-sync/half-async模式简介 238
14.2 half-sync/half-async模式的架构 238
14.3 half-sync/half-async模式实战案例解析 240
14.4 half-sync/half-async模式的评价与实现考量 249
14.4.1 队列积压 250
14.4.2 避免同步任务层处理过慢 251
14.5 half-sync/half-async模式的可复用实现代码 251
14.6 java标准库实例 256
14.7 相关模式 256
14.7.1 two-phase termination模式(第5章) 256
14.7.2 producer-consumer模式(第7章) 256
14.7.3 active object模式(第8章) 256
14.7.4 thread pool模式(第9章) 257
14.8 参考资源 257
5章 模式语言 258
15.1 设计模式之间的联系 258
15.2 immutable object模式 260
15.3 guarded suspension模式 261
15.4 two-phase termination模式 262
15.5 promise模式 263
15.6 producer-consumer模式 264
15.7 active object模式 265
15.8 thread pool模式 266
15.9 thread specific storage模式 267
15.10 serial thread confinement模式 268
15.11 master-slave模式 269
15.12 pipeline模式 270
15.13 half-sync/half-async模式 271
附录a 本书常用uml图指南 272
参考文献 281

内容简介

随着cpu多核时代的到来,多线程编程在充分利用计算资源、提高软件服务质量方面扮演了越来越重要的角。解决多线程编程中频繁出现的普遍问题可以借鉴设计模式所提供的现成解决方案。然而,多线程编程相关的设计模式图书多采用c++作为描述语言,且书中所举的例子多与应用开发人员的实际工作相去甚远。本书采用java语言和uml为描述语言,并结合作者多年工作经历及相关实践经验,介绍了多线程环境下常用设计模式的来龙去脉:各个设计模式是什么样的、典型的实际应用场景、实际应用时需要注意的事项及各个设计模式的可复用代码实现。本书第2版除更正了版中的错误外,还新增了k8、k9中与多线程设计模式相关的内容,并对代码行了重构和重新排版,使代码部分重点更突出、更易于阅读,以及提高了图的清晰度。本书适合有java多线程编程基础、经验的读者阅读。