1, when to use multithreading: when more than one code colleague executes the need to use multi-threading.
2,JVM itself is multithreaded, because in the process of running the program will generate a lot of garbage in the heap memory, you need to be recycled by the garbage collector.
When the 3,main function code executes, garbage collection is also running. So it's done at the same time, and that's two separate threads to control.
4, the thread that performs the garbage collection is called the garbage collection thread.
5, the thread that executes the main function, is called the main path.
6, the purpose of creating an execution path (thread) is to have a single thread execute the specified code and other code colleagues. This is the purpose of creating threads.
7, for the main thread: its running code degrees are stored in the main function.
8, for garbage collection threads: It runs the code that is used to reclaim object garbage.
Multithreading two: The main thread in the JVM & the garbage collection thread