Multithreading Terms
- The terms multithreading and concurrent programming mean to have more than one thread of execution in a single program.
- When do you want more than 1 thread? Typically when you have tasks that are independent or that may take a while to complete.
- If you use a separate thread, your program can continue
processing rather than wait for each task to complete before proceeding
to the next one.
- In Java, the garbage collector automatically runs as a separate thread. So does loading an Image or sound clip.
- You can purposely write your programs to use multiple threads when you have tasks that need to run concurrently.
- Use the Thread class or implement Runnable to create a thread.
- With a thread, most of the "work" for the program should be in run().