Threads allow a program to run as multiple concurrent strands of executable statements. These different strands of execution, or threads, have been implemented on some systems so that they are truly running in parallel on different processors; however, they may implemented so that they only appear to be executing in parallel but are actually running in sequence, but with a single processor switching among them. Regardless of the implementation, threads represent a different way of thinking about a process. Just as you may have found recursion an abstract and difficult concept to understand when you first encountered it, don't be surprised if it takes you a while to become comfortable with threads.The discussion of threads will be general, but brief. It will not be explored in all of its manifestations in Java, but restricted to those aspects required for a reasonable implementation of a multi-threaded client and server architecture, which will be discussed next.
Topics
- Begin discussion of Java threads.
- Thread class
- Runnable interface
References
Useful references include:
- Sun's Java Development Kit (JDK)
- The API
- The API Class Hierarchy
- Source Code for JDK Packages
Assignment for Next Class
- Read Java Clients & Servers II class tutorial.