We start very gently by looking at a game that introduces the concepts of concurrency - 7 Billion Humans
There are two other game-play videos that follow up from this one:
Pages 77 - 82 of “The Well-Grounded Java Developer” by Evans and Verburg.
You have been provided with some simple Java code that demonstrates threading. It is clear from the output of this program that the code does not run “from top-to-bottom” as we are used to. Give an account of what is going on here, including a description of what state each thread is in at any point in the program. If you experiment with breakpoints you will see some very strange behavour - can you explain it?
You have been provided with some Java code that demonstrates the different states a
Thread might be in. Download this code and run it to see what it does.
You should see that it starts up 10 threads all trying to read the time from a webservice. The webservice doesn’t like DOS attacks, so it rejects requests if they come too fast. For that reason the method that tries to get the time will wait some (random) amount of time before asking. As the program runs, it will show you the state of each of the 10 threads. Inspect the source code to see what each code means. You should convince yourself that you understand what state transitions are happening and why.