CONCURRENCY PROBLEMS
Issues that you encounter with threads in professional development can be Byzantine in their complexity, and concise thread problems appropriate for an interview are difficult to compose. Therefore, the questions you get are likely to come from a fairly small set of classic thread problems, several of which are presented here.
Busy Waiting
This is a simple problem, but one with important performance implications for any multithreaded application.
Consider a thread that spawns another thread to complete a task. Assume that the first thread needs to wait for the second thread to finish its work, and that the second thread terminates as soon as its work is done. The simplest approach is to have the first thread keep checking whether the second thread is alive and proceed as soon as it is dead:
Thread task = new TheTask();
task.start();
while ( task.isAlive() ){
; // do nothing...