Practical Java High Concurrency Programming cover

Practical Java High Concurrency Programming

No rating yet
Word count
493 words
Chapters
40
ISBN
9787121273049

Tags

Summary

Practical Java High Concurrency Programming is a hands-on book on concurrent programming for developers with some Java experience. It opens with the historical context of parallel computing, then reviews the basic concepts of synchronous and asynchronous, concurrency and parallelism, critical sections, blocking and non-blocking, and deadlock and livelock, along with concurrency levels, Amdahl's law and Gustafson's law, and grounds them in the atomicity, visibility, ordering and Happens-Before rules of the Java memory model. On this foundation, the book systematically explains how to write Java parallel programs: creating, terminating, interrupting, waiting and notifying threads; join and yield; volatile and the memory model; thread groups, daemon threads and thread priorities; synchronized and thread safety; and subtle pitfalls such as ArrayList and HashMap under concurrency and a common incorrect locking pattern. The middle section focuses on the JDK concurrency package: reentrant locks and Condition, Semaphore, ReadWriteLock, CountDownLatch, CyclicBarrier, LockSupport and AbstractQueuedSynchronizer; the internal implementation and rejection policies of thread pools; the Fork/Join framework; and concurrent containers such as ConcurrentHashMap, ConcurrentLinkedQueue, CopyOnWriteArrayList, BlockingQueue and skip lists. The book then turns to lock optimization, including reducing lock granularity, lock separation, lock coarsening, biased locking, lightweight locking, spin locks and lock elision, as well as ThreadLocal, CAS and the various atomic classes, and deadlock issues. It also discusses parallel design patterns and algorithms (singleton, immutability, producer-consumer, Future, parallel sorting and more), Java 8 support for parallel programs, and introduces the high-concurrency framework Akka and methods for debugging parallel programs.

Editor's review

很多讲并发的书停在「概念+API罗列」,这本的可贵之处是每一步都带着可运行的代码。作者从线程的基本操作讲到JDK并发包,再把锁优化、无锁算法、设计模式、Akka逐个拆开,读下来能搭起一条从「会用」到「知道为什么快」的完整链路。 书里的例子大多来自真实开发中的坑:并发下的ArrayList会怎样出错、HashMap为什么不安全、为什么你的加锁方式其实是错的、线程池里的堆栈去哪了。这些问题在面试和线上排查中都极为常见,单独拎出来看比抽象讲解更有效果。 语言风格偏口语化,配图多为手绘示意,降低了阅读门槛。对想系统补齐并发知识、又不想一上来就啃大块头理论书的开发者来说,这本是性价比很高的选择。

Who it's for

A good fit for

  • 已经会写Java基础代码、想系统掌握多线程与并发编程的开发人员
  • 需要处理高并发场景、进行系统调优的后端工程师
  • 准备Java技术面试、需要梳理JUC与内存模型的知识型读者
  • 软件设计师、架构师中需要补足并发底层原理的人

Not a good fit for

  • 完全没有Java基础、还不熟悉类与线程基本用法的初学者
  • 只想读纯理论推导、对代码实战不感兴趣的研究型读者
  • 做其他语言开发且短期内不接触Java生态的工程师

Reading tips

  1. 第1、2章不要跳过,内存模型和线程基础是后面所有内容的根基。
  2. 每个示例最好亲手敲一遍并改参数观察现象,并发问题光看结论记不牢。
  3. 读完第3章后可以回头对照自己项目里的线程池与锁,逐条排查隐患。
  4. 锁优化和Akka部分可先通读建立印象,等到遇到相应场景再精读。

About the publisher

Publishing House of Electronics Industry China · Founded in 1982

The Publishing House of Electronics Industry is a comprehensive publisher distinguished by its focus on electronic information and related fields. Judging from the more than 3,000 titles in its catalogue, its publishing covers programming and design, artificial intelligence, computer science, finance and economics, photography, and social sciences, attending both to cutting-edge technology and to general readers. Representative titles include Factor Investing: Methods and Practice, x86 Assembly Language: From Real Mode to Protected Mode, The RISC-V Reader, Artificial Intelligence: Speech Recognition, Understanding and Practice, Phased Array Radar Technology, Radar Target Characteristics, and 100 Go Mistakes and How to Avoid Them, most of which centre on technical methods and engineering practice. Its authors include Shi Chuan, Li Zhong, Wang Xiaobo, David Patterson, Andrew Waterman, and Yu Zihao, among others from China and abroad. Owing to limited public information, no further publishing features are elaborated here.

Contents

  1. Chapter 1 Entering the Parallel World
  2. 1.1 Parallel Computing at a Crossroads
  3. 1.2 Synchronous and Asynchronous, Concurrency and Parallelism, Critical Sections, Blocking and Non-blocking, Deadlock, Starvation and Livelock
  4. 1.3 Concurrency Levels: Blocking, Starvation-Free, Obstruction-Free, Lock-Free, Wait-Free
  5. 1.4 Amdahl's Law and Gustafson's Law
  6. 1.5 The Java Memory Model: Atomicity, Visibility, Ordering and the Happens-Before Rules
  7. Chapter 2 Fundamentals of Java Parallel Programs
  8. 2.1 Basic Thread Operations: Creating, Terminating, Interrupting, wait/notify, suspend/resume, join/yield
  9. 2.2 volatile and the Java Memory Model
  10. 2.3 Thread Groups, Daemon Threads and Thread Priorities
  11. 2.4 Thread Safety and the synchronized Keyword
  12. 2.5 Hidden Errors in Programs: ArrayList and HashMap Under Concurrency, Incorrect Locking
  13. Chapter 3 The JDK Concurrency Package
  14. 3.1 Synchronization Control: Reentrant Locks, Condition, Semaphore, ReadWriteLock, CountDownLatch, CyclicBarrier, LockSupport, AQS
  15. 3.2 Thread Pools: Internal Implementation, Rejection Policies, ThreadFactory, Thread Count Optimization, the Fork/Join Framework
  16. 3.3 Concurrent Containers: ConcurrentHashMap, ConcurrentLinkedQueue, CopyOnWriteArrayList, BlockingQueue, Skip Lists
  17. Chapter 4 Lock Optimization and Points to Note
  18. 4.1 Reducing Lock Hold Time, Reducing Lock Granularity, Read-Write Separation Locks, Lock Separation, Lock Coarsening
  19. 4.2 Virtual Machine Lock Optimization: Biased Locking, Lightweight Locking, Spin Locks, Lock Elision
  20. 4.3 ThreadLocal and ThreadLocalRandom
  21. 4.4 Lock-Free Programming and CAS: AtomicInteger, Unsafe, AtomicReference, AtomicStampedReference and the Various Atomic Classes
  22. 4.5 Issues Related to Deadlock
  23. Chapter 5 Parallel Patterns and Algorithms
  24. 5.1 The Singleton Pattern and the Immutable Pattern
  25. 5.2 The Producer-Consumer Pattern and Its Lock-Free Implementation: Disruptor and the False Sharing Problem
  26. 5.3 The Future Pattern and Guava Support
  27. 5.4 Parallel Pipelines, Parallel Search and Parallel Sorting
  28. 5.5 Parallel Algorithms for Matrix Multiplication, Network NIO and AIO
  29. Chapter 6 Java 8 and Concurrency
  30. 6.1 Fundamentals of Functional Programming and Lambda Expressions
  31. 6.2 Parallel Streams and Parallel Sorting
  32. 6.3 CompletableFuture
  33. 6.4 StampedLock, LongAdder and LongAccumulator
  34. 6.5 Enhancements to ConcurrentHashMap and the Publish-Subscribe Pattern
  35. Chapter 7 Building High-Concurrency Programs with Akka
  36. 7.1 The Actor Model and Getting Started with Akka
  37. 7.2 Message Delivery, Actor Lifecycle and Supervision Strategies
  38. 7.3 Message Routing, Built-in State Transitions and the Ask Pattern
  39. 7.4 Agents and Software Transactional Memory
  40. 7.5 Implementing a Concurrent Particle Swarm Algorithm with Akka

FAQ

这本书需要什么基础才能读?
需要具备基本的Java语法和面向对象知识,最好写过带线程的代码。书中术语如内存模型、锁、线程池都从概念讲起,但完全没有编程经验会觉得吃力。
这本书和《Java并发编程实战》有什么区别?
《Java并发编程实战》偏重理论体系与设计原则,语言更学术;本书则以中文白话讲解配合大量代码实例,覆盖JUC工具类、锁优化、Akka和高并发调试,实战与工程色彩更浓。
书中内容对应哪个Java版本?
第1版主要基于JDK 8,示例在JDK 1.8以上环境运行,并介绍了Java 8在并行流等方面对并发的支持。若想学习更新版本的特性,可参考后续第2版、第3版。
适合用来准备面试吗?
适合作为梳理知识框架的读物。synchronized与锁升级、ConcurrentHashMap、线程池参数与拒绝策略、CAS与ABA问题等高频考点书中都有展开,但需要自己配合刷题巩固。

Comments

Find this book

This site is an index: you start “Search all sources” in your browser, and the entries it lists all point to third-party sites; please judge their availability yourself.

About the author

葛一鸣 Author

Ge Yiming is a programming author about whom limited public information is available. His confirmed representative work is Practical Java High-Concurrency Programming (3rd Edition). The book falls under programming design, and its title and successive editions suggest a practice-oriented focus on Java concurrency programming that has been revised over time, indicating a degree of continuity among technical readers. In the absence of clear information about his personal life, education, professional career, awards, or honors, no further speculation about his background should be made. Based on the available work, Ge Yiming's writing is practice-oriented and centers on high-concurrency programming, serving developers who wish to gain a deeper understanding of Java concurrency mechanisms. His profile is therefore best framed in terms of the subject matter and technical direction of his work rather than unverified personal achievements.

郭超 Author

Guo Chao's publicly available information is currently limited, and his signed works span such varied fields as traditional culture, social policy, and information technology. In the area of literary appreciation, he took part in compiling Tai Gong Liu Tao, indicating an interest in ancient military classics and strategic culture. In the social sciences, his work Research on China's Disability Reporting System addresses data statistics and institutional development in the field of disability affairs. He also compiled A Project-Based Tutorial on College Information Technology, a textbook for university IT teaching that reflects a project-based learning approach. These works show Guo Chao moving across classical-text interpretation, social research, and textbook writing, with an emphasis on organizing knowledge and practical application; his style is pragmatic and his readership varied. Owing to the lack of biographical information, his personal history and academic background cannot yet be further introduced.

More by the same author

Top rated in the same category