JAVAnote multi-threading related knowledge

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

Guess you like

Origin blog.csdn.net/h201601060805/article/details/133760611