Card 08/ 08
All 8 cards
RecapDifficulty: Advanced1 min
What a Thread Is, What It Costs, and What Stops It
Five things this topic established, and where each one was.
| The thing | Where |
|---|---|
start() creates a thread; run() is an ordinary method call | Why Calling run() Directly Started Nothing |
| Each thread's own order holds; the interleaving between threads does not | Two Threads Printing at Once |
| A thread runs once and cannot be restarted | The States a Thread Moves Through |
| A virtual thread is scheduled by the virtual machine and costs almost nothing | A Platform Thread Against a Virtual Thread |
| The process exits when the last non-daemon thread finishes | Why 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.