In this chapter we'll investigate the facilities Java has to enable you to overlap the execution of segments of a single program. As well as ensuring your programs run more efficiently, this capability is particularly useful when your program must, of necessity, do a number of things at the same time: for example, a server program on a network that needs to communicate with multiple clients.
In this chapter you will learn:
What a thread is and how you can create threads in your programs.
How to control interactions between threads.
What synchronization means and how to apply it in your code.
What deadlocks are, and how to avoid them.
How to set thread priorities.
How to get information about the threads in your programs.