Card 08/ 08

RecapDifficulty: Advanced1 min

What a Thread Is, What It Costs, and What Stops It

Five things this topic established, and where each one was.

What the topic established, and which card it was on
The thingWhere
start() creates a thread; run() is an ordinary method callWhy Calling run() Directly Started Nothing
Each thread's own order holds; the interleaving between threads does notTwo Threads Printing at Once
A thread runs once and cannot be restartedThe States a Thread Moves Through
A virtual thread is scheduled by the virtual machine and costs almost nothingA Platform Thread Against a Virtual Thread
The process exits when the last non-daemon thread finishesWhy Your Program Will Not Exit

A thread buys overlap and spends ordering. Everything in the topics after this one is about the consequences of that trade, and none of it is visible in code that runs on one thread.