Multithreading two: The main thread in the JVM & the garbage collection thread

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.