Multi-threaded application scenarios:
Time-consuming operations in the software:
1. Copy and migrate large files. 2. Load a large number of resource files
All chat software
All backend servers
Concurrency and parallelism
Concurrency: At the same time, multiple instructions are running alternately on a single CPU
Parallel: At the same time, multiple instructions are running simultaneously on multiple CPUs, if there are two cores and four threads That means you can run 4 threads of data at a time
How to implement multi-threading
1. Implement by inheriting the Thread class
2. Implement by implementing the Runable interface
3. Implement by using the callable interface