試讀章節
序
第五章 極簡同步化的技巧

Thread 是 Java 程式設計的基本要素,但學習如何有效率的運用它們是很重要的工作。新版的「Java
Threads」此一經典為你展示出如何完全地運用 Java 的 threading 功能 且展示出在 Java 2 Standard Edition
Version 5.0(J2SE 5.0)上最新的變動。本書提供了完整與步驟詳盡的 thread 程式設計方法。
Java 的 threading 系統與其他的 threading 系統相較之下更為簡單。在早期的 Java
版本中,簡化是互有利弊的:在其它 threading 系統上可以看到的某些高階功能在 Java 中是找不到的。J2SE 5.0 改變了一切:它提供了非常多與
thread 相關的新 class 能夠讓撰寫 multithreaded 程式的工作變得更簡單。
Java Threads 第三版,已經過完整的擴編與修訂。本書有完整收錄來自 java.util.concurrent
的並行功能。新的章節涵蓋到 thread 的效能、在 Swing 中使用 thread、thread 與 Collection class、thread
pool、以及 thread 與 I/O(傳統的、新型的、插斷的)。還無法部署 J2SE 5.0 的開發者可以藉由附錄中所提供的 thread
工具於較早的 Java 版本中達成類似的功能性。
主題涵蓋有:
- Lock starvation 與死結偵測。
- Atomic class 與極簡同步化(J2SE 5.0)。
- Swing、I/O、以及 Collection class 與 Java thread 的互動。
- 程式化的控制 lock 與 condition variable(J2SE 5.0)。
- Thread 的效能與安全性。
- Thread pool(J2SE 5.0)。
- Thread group。
- 特定平台上的 thread 排程。
- Task scheduler(J2SE 5.0)。
- 多處理器環境下的平行迴圈。
|