tailieunhanh - Lecture Object Oriented Programing - Chapter 23: Multithreading

In chapter 23 you will learn: What threads are and why they are useful, how threads enable you to manage concurrent activities, the life cycle of a thread, thread priorities and scheduling, to create and execute runnables, thread synchronization, what producer/consumer relationships are and how they are implemented with multithreading. | 23 Multithreading The most general definition of beauty Multeity in Unity. Samuel Taylor Coleridge Do not block the way of inquiry. Charles Sanders Peirce A person with one watch knows what time it is; a person with two watches is never sure. Proverb Learn to labor and to wait. Henry Wadsworth Longfellow The world is moving so fast these days that the man who says it can’t be done is generally interrupted by someone doing it. Elbert Hubbard OBJECTIVES In this chapter you will learn: What threads are and why they are useful. How threads enable you to manage concurrent activities. The life cycle of a thread. Thread priorities and scheduling. To create and execute Runnables. Thread synchronization. What producer/consumer relationships are and how they are implemented with multithreading. To enable multiple threads to update Swing GUI components in a thread-safe manner. About interfaces Callable and Future, which you can use with threading to execute tasks that return . | 23 Multithreading The most general definition of beauty Multeity in Unity. Samuel Taylor Coleridge Do not block the way of inquiry. Charles Sanders Peirce A person with one watch knows what time it is; a person with two watches is never sure. Proverb Learn to labor and to wait. Henry Wadsworth Longfellow The world is moving so fast these days that the man who says it can’t be done is generally interrupted by someone doing it. Elbert Hubbard OBJECTIVES In this chapter you will learn: What threads are and why they are useful. How threads enable you to manage concurrent activities. The life cycle of a thread. Thread priorities and scheduling. To create and execute Runnables. Thread synchronization. What producer/consumer relationships are and how they are implemented with multithreading. To enable multiple threads to update Swing GUI components in a thread-safe manner. About interfaces Callable and Future, which you can use with threading to execute tasks that return results. Introduction Thread States: Life Cycle of a Thread Thread Priorities and Thread Scheduling Creating and Executing Threads Runnables and the Thread Class Thread Management with the Executor Framework Thread Synchronization Producer/Consumer Relationship without Synchronization Unsynchronized Data Sharing Synchronized Data Sharing—Making Operations Atomic Producer/Consumer Relationship: ArrayBlockingQueue Producer/Consumer Relationship with Synchronization Producer/Consumer Relationship: Bounded Buffers Producer/Consumer Relationship: The Lock and Condition Interfaces Multithreading with GUI Other Classes and Interfaces in Performing Computations in a Worker Thread Processing Intermediate Results wit SwingWorker Wrap-Up Introduction The human body performs a great variety of operations in parallel—or concurrently Computers, too, can .