Java Threads, Second Edition by Scott Oaks
Читать

Java Threads, Second Edition by Scott Oaks

Book Summary of Java Threads, 2nd Edition Threads aren't a new idea: many operating systems and languages support them. Until Java, threads tended to be something that everyone talked about, but few used. Programming with threads was tricky and non portable. Not so with Java. Java's thread facilities are easy to use, and like everything else in Java are portable between platforms. And that's a good thing, because it's impossible to write anything but the simplest applet without encountering threads. If you want to work with Java, you have to learn about threads. This new edition of the classic Java Threads shows you how to take full advantage of Java's thread facilities, and brings you up to date with the latest changes in the thread interface for JDK 2. You'll learn where to use threads to increase efficiency, how to use them effectively, and how to avoid common mistakes. This book discusses problems like deadlock, race condition, and starvation in detail, helping you to write code without hidden bugs. Java Threads, Second Edition, offers a thorough discussion of the Thread and ThreadGroup classes, the Runnable interface, and the language's synchronized operator. It explains how threads are scheduled on different platforms, and shows you how to develop a CPUScheduler class that implements your own scheduling policy. Other extended examples include classes that implement reader/writer locks, general locks, locks at arbitrary scope, and asynchronous I/O. This edition also adds extensive examples showing how to implement thread pools and other synchronization techniques, like condition variables, barriers, and daemon locks. It shows how to work with classes that are not thread safe, and pays special attention to threading issues with Swing. A new chapter shows you how to write parallel code for multiprocessor machines.