Study Notes (12): 19 years and principles of concurrent programming video training tutorials entry to the master - thread priority

Learning immediately: https://edu.csdn.net/course/play/9827/208789?utm_source=blogtoedu

Thread priority

          Priority thread of the thread of the importance of telling how much. If a large number of threads are blocked. Are waiting to run, the program will first run priority of that thread as much as possible. However, this does not mean that lower-priority thread does not run. If a lower priority thread, only represent a small number of opportunities it is permitted to run it.

    Priority thread may be any value from 1 to 10, the Thread class defines three thread priority, are: MIN_PRIORITY (1), NORM_PRIORITY (5), MAX_PRIORITY (10), the generally recommended several constant, do not set the value yourself.

    Different platforms, different for priority support thread. Programming, do not over-rely on thread priority, if your program is running correctly depending on the priority run if you set priorities in accordance with the set, and that such a program is not correct.

task:

    Quick processing: high-priority settings

    Slowly Remedy: Set a low priority

Published 22 original articles · won praise 21 · views 262

Guess you like

Origin blog.csdn.net/weixin_45831970/article/details/104373746