執行緒優先順序

2021-05-22 04:53:00 字數 3687 閱讀 8751

執行緒優先順序由執行緒所屬程序的優先順序類、執行緒自身的相對優先級別共同確定,二者組合值作為執行緒的基優先順序。(base   priority   level)  

win32系統中,執行緒基優先順序的範圍從最低優先順序0到最高優先順序31。

系統優先順序程式優先順序類別

執行緒優先順序等級

1idle_priority_class

thread_priority_idle

1below_normal_priority_class

thread_priority_idle

1normal_priority_class

thread_priority_idle

1above_normal_priority_class

thread_priority_idle

1high_priority_class

thread_priority_idle

2idle_priority_class

thread_priority_lowest

3idle_priority_class

thread_priority_below_normal

4idle_priority_class

thread_priority_normal

4below_normal_priority_class

thread_priority_lowest

5idle_priority_class

thread_priority_above_normal

5below_normal_priority_class

thread_priority_below_normal

5background normal_priority_class

thread_priority_lowest

6idle_priority_class

thread_priority_highest

6below_normal_priority_class

thread_priority_normal

6background normal_priority_class

thread_priority_below_normal

7below_normal_priority_class

thread_priority_above_normal

7background normal_priority_class

thread_priority_normal

7foreground normal_priority_class

thread_priority_lowest

8below_normal_priority_class

thread_priority_highest

8normal_priority_class

thread_priority_above_normal

8foreground normal_priority_class

thread_priority_below_normal

8above_normal_priority_class

thread_priority_lowest

9normal_priority_class

thread_priority_highest

9foreground normal_priority_class

thread_priority_normal

9above_normal_priority_class

thread_priority_below_normal

10foreground normal_priority_class

thread_priority_above_normal

10above_normal_priority_class

thread_priority_normal

11foreground normal_priority_class

thread_priority_highest

11above_normal_priority_class

thread_priority_above_normal

11high_priority_class

thread_priority_lowest

12above_normal_priority_class

thread_priority_highest

12high_priority_class

thread_priority_below_normal

13high_priority_class

thread_priority_normal

14high_priority_class

thread_priority_above_normal

15high_priority_class

thread_priority_highest

15high_priority_class

thread_priority_time_critical

15idle_priority_class

thread_priority_time_critical

15below_normal_priority_class

thread_priority_time_critical

15normal_priority_class

thread_priority_time_critical

15above_normal_priority_class

thread_priority_time_critical

16realtime_priority_class

thread_priority_idle

17realtime_priority_class

-718

realtime_priority_class

-619

realtime_priority_class

-520

realtime_priority_class

-421

realtime_priority_class

-322

realtime_priority_class

thread_priority_lowest

23realtime_priority_class

thread_priority_below_normal

24realtime_priority_class

thread_priority_normal

25realtime_priority_class

thread_priority_above_normal

26realtime_priority_class

thread_priority_highest

27realtime_priority_class328

realtime_priority_class429

realtime_priority_class530

realtime_priority_class631

realtime_priority_class

thread_priority_time_critical

執行緒優先順序

優先順序是執行緒排程的重要依據。優先順序高的執行緒,永遠先獲得cpu的青睞。當然啦,作業系統會視情況調整各個執行緒的優先順序。例如前台執行緒的優先順序應該調高一些,後台執行緒的優先順序應該調低一些。執行緒的優先順序範圍從0 最低 到31 最高 當你產生執行緒時,並不是直接以數值指定其優先順序,而是採...

執行緒優先順序

知識點 執行緒優先順序 獲取當前執行緒控制代碼 執行緒優先順序設定 執行緒優先順序變動 執行緒優先順序獲取 一 執行緒優先順序 thread priority 簡單的說就是 執行緒 的優先順序越高,那麼就可以分佔相對多的cpu時間片。每個程序都有相應的優先順序,優先順序決定它何時執行和占用 cpu ...

執行緒優先順序

優先順序 執行緒的優先順序將該執行緒的重要性傳給排程器,儘管cpu處理執行緒的順序不確定,但好似cpu排程器會更傾向於讓優先權最高的執行緒先執行,優先順序低的執行緒僅僅是執行頻率較低,不會導致死鎖。public class liftoff implements runnable public voi...