The Java platform supports multitasking through threads. Each thread is a separate flow of control, executing concurrently with all other threads. If the computer has several CPUs available, separate threads may execute literally at the same time. If not, the JVM implementation can let each thread run for a while, then interrupt it to let a different thread run.
The features that make up the Java platform thread model are divided between the JVM itself and the class
java.lang.Thread. This class is found on all Java platforms. It contains methods for spawning new threads, controlling thread priority, and stopping and starting thread execution.
The JVM's support for threads lies in its ability to provide synchronization. ...