Java Threads. 2nd Edition - Brossura

Oaks, Scott; Wong, Henry

 
9781565924185: Java Threads. 2nd Edition

Sinossi

Threads aren't a new idea: many operating systems and languages support them. But despite widespread support, threads tend to be something that everyone talks about, but few use. Programming with threads has a reputation for being tricky and nonportable. However, Java's thread facilities are easy to use and completely portable between platforms. Revised to cover Java 1.2, this text focuses on Java's thread facilities, showing: where to use threads to increase efficiency, how to use them effectively, and how to avoid common mistakes. It covers the Thread and ThreadGroup classes, the Runnable interface, and the language's synchronized operator. It explains thread scheduling ends by developing a CPUSchedule class, showing how to implement a scheduling policy. Extended examples include classes that implement reader/writer locks, general locks, locks at arbitrary scope, and asynchronous I/O.

Le informazioni nella sezione "Riassunto" possono far riferimento a edizioni diverse di questo titolo.

L'autore

Scott Oaks is a Java Technologist at Sun Microsystems, where he has worked since 1987. While at Sun, he has specialized in many disparate technologies, from the SunOS kernel to network programming and RPCs. Since 1995, hes focused primarily on Java and bringing Java technology to end-users. Scott also authored OReillys Java Security, Java Threads and Jini in a Nutshell titles.

Henry Wong is a tactical engineer at Sun Microsystems, where he has worked since 1989. Originally hired as a consultant to help customers with special device drivers, kernel modifications, and DOS interoperability products, Henry has also worked on Solaris ports, performance tuning projects, and multithreaded design and implementations for benchmarks and demos. Since early 1995, Henry has been involved in developing Java prototypes and supporting customers who are using Java. Prior to joining Sun, Henry earned a bachelor of science degree in chemical engineering from The Cooper Union in 1987. He joined a small software company in 1986 working on SCSI device drivers, image and audio data compression, and graphics tools used for a medical information system. When not in front of a computer, Henry is an instrument rated private pilot, who also likes to dabble in archery, cooking, and traveling to different places with his wife, Nini.

Contenuti

Preface; Who Should Read This Book?; Versions Used in This Book; Organization of This Book; Conventions Used in This Book; Feedback for Authors; Acknowledgments; Chapter 1: Introduction to Threading; 1.1 Java Terms; 1.2 Thread Overview; 1.3 Why Threads?; 1.4 Summary; Chapter 2: The Java ThreadingAPI; 2.1 Threading Using the Thread Class; 2.2 Threading Using the Runnable Interface; 2.3 The Life Cycle of a Thread; 2.4 Thread Naming; 2.5 Thread Access; 2.6 More on Starting, Stopping, and Joining; 2.7 Summary; Chapter 3: Synchronization Techniques; 3.1 A Banking Example; 3.2 Reading Data Asynchronously; 3.3 A Class to Perform Synchronization; 3.4 The Synchronized Block; 3.5 Nested Locks; 3.6 Deadlock; 3.7 Return to the Banking Example; 3.8 Synchronizing Static Methods; 3.9 Summary; Chapter 4: Wait and Notify; 4.1 Back to Work (at the Bank); 4.2 Wait and Notify; 4.3 wait(), notify(), and notifyAll(); 4.4 wait() and sleep(); 4.5 Thread Interruption; 4.6 Static Methods (Synchronization Details); 4.7 Summary; Chapter 5: Useful Examplesof Java Thread Programming; 5.1 Data Structures and Containers; 5.2 Simple Synchronization Examples; 5.3 A Network Server Class; 5.4 The AsyncInputStream Class; 5.5 Using TCPServer with AsyncInputStreams; 5.6 Summary; Chapter 6: Java Thread Scheduling; 6.1 An Overview of Thread Scheduling; 6.2 When Scheduling Is Important; 6.3 Scheduling with Thread Priorities; 6.4 Popular Scheduling Implementations; 6.5 Native Scheduling Support; 6.6 Other Thread-Scheduling Methods; 6.7 Summary; Chapter 7: Java Thread Scheduling Examples; 7.1 Thread Pools; 7.2 Round-Robin Scheduling; 7.3 Job Scheduling; 7.4 Summary; Chapter 8: Advanced Synchronization Topics; 8.1 Synchronization Terms; 8.2 Preventing Deadlock; 8.3 Lock Starvation; 8.4 Thread-Unsafe Classes; 8.5 Summary; Chapter 9: Parallelizing for Multiprocessor Machines; 9.1 Parallelizing a Single-Threaded Program; 9.2 Inner-Loop Threading; 9.3 Loop Printing; 9.4 Multiprocessor Scaling; 9.5 Summary; Chapter 10: Thread Groups; 10.1 Thread Group Concepts; 10.2 Creating Thread Groups; 10.3 Thread Group Methods; 10.4 Manipulating Thread Groups; 10.5 Thread Groups, Threads, and Security; 10.6 Summary; Miscellaneous Topics; Thread Stack Information; General Thread Information; Default Exception Handler; The ThreadDeath Class; The Volatile Keyword; Exceptions and Errors; InterruptedException; InterruptedIOException; NoSuchMethodError; RuntimeException; Colophon;

Le informazioni nella sezione "Su questo libro" possono far riferimento a edizioni diverse di questo titolo.