Threading Model   «Prev  Next»

Lesson 10

Java Multi-Threading Conclusion

The following list summarizes the important points about threads that were covered in this module:
  1. The task scheduler implements multithreading support by quickly switching between the threads that are executed by a system's CPU or CPUs.
  2. Threads may be created by extending the Thread class or implementing the Runnable interface.
  3. A thread's run() method is its entry point.
  4. The start() method of the Thread class is invoked to start a thread executing as a separate sequence of instructions. This results in the thread's run() method being invoked by the JVM.
  5. Thread states are New, Runnable (ready), running, waiting, and dead.
  6. The thread scheduler moves threads from the Runnable (ready) state to the running state.
  7. Threads are scheduled based on their priority and the operating system's scheduling algorithm (preemptive scheduling or time slicing).
  8. A thread may invoke its yield() method to move from the Running state to the Runnable (ready) state.
  9. A thread may move from the Running state to the waiting state as the result of invoking its sleep()method, blocking on I/O, waiting for a lock, or invoking an object's wait() method.
  10. A thread enters the dead state when its run() method returns.
  11. Synchronization coordinates access to shared objects among multiple threads.
  12. Synchronization is maintained through the use of locks.
  13. The wait(), notify(), and notifyAll() methods can be used to cause threads to wait until an object is updated by another thread.

Key terms and concepts

  1. Thread: A sequence of statements that is executed as part of a program
  2. Multithreaded program: A program that simultaneously supports more than one thread of execution.
  3. Thread scheduler: The part of an operating system that assigns threads to CPUs, also referred to as the scheduler.
  4. Scheduler: The part of an operating system that assigns threads to CPUs, also referred to as the thread scheduler.
  5. Execution state: The states occupied by a thread during the course of its execution.
  6. Scheduling: The assignment of threads to CPUs.
  7. Thread priority: A ranking of threads that determines their likelihood of being scheduled.
  8. Preemptive scheduling: An approach to scheduling in which the highest priority thread continues to execute until it enters a wait state or a higher priority thread comes into existence.
  9. Time slicing: A scheduling approach in which a thread executes for a slice of time and then enters a waiting state while another (possibly same) thread is scheduled.
  10. Synchronization: The coordination of multi-thread access to shared objects
  11. Entry point: The first method that is executed when an application (main()), thread (run()) is executed.
  12. Lock: A mechanism for implementing shared access to an object, also referred to as a monitor

Thread Concepts - Exercise

Click the link below to complete the Thread Concepts - Exercise
Thread Concepts - Exercise

Multithreading - Quiz

Click the Quiz link below to check your understanding of threads.
Multithreading - Quiz