005 thread ID and Thread priority

Source: Internet
Author: User

I. Overview

Priority of the thread:

When we create a thread, we specify a priority that affects the chance that the thread will execute.

The meaning of the opportunity is that the thread executes more, but there is no guarantee that the thread will execute more times than the lower priority thread for a certain amount of time.

Priority: It can only represent a probability when the priority is guaranteed to be valid during a long run.

The ID of the thread:

When the JVM is created, it gives the thread an ID, which is the number given to the default thread name. (Available in the source code).

In fact, like the name of the thread, the ID is just a property that identifies the thread.

Two. Role and complement of priorities

We can not rely on the priority to determine the order of execution of threads, and this will depend on the synchronization of threads to complete.

  

    

  

005 thread ID and Thread priority

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.