1 / 93

Linux Kernel Process Scheduling

Linux Kernel Process Scheduling. 9662541 張文軒 9665510 許晉榮 9665531 林奕翔. 什麼是 Scheduling??. 簡單來說就是安排 Process 執行的順序. 那幹嘛要安排順序呢 ?. 要可以讓很多很多程式一起執行 要讓所有程 Process 都可以運作順暢 反應快速 不能讓 Process 插隊來 插隊去 要讓大家都公平 雖然要公平 但事情也事有輕重緩急. Linux process scheduling 用了什麼方法 ?. 就三個字 優先權.

lavanya
Télécharger la présentation

Linux Kernel Process Scheduling

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Linux Kernel Process Scheduling

  2. 9662541 張文軒 9665510 許晉榮 9665531 林奕翔

  3. 什麼是Scheduling??

  4. 簡單來說就是安排Process執行的順序

  5. 那幹嘛要安排順序呢?

  6. 要可以讓很多很多程式一起執行 要讓所有程Process都可以運作順暢 反應快速 不能讓Process插隊來 插隊去 要讓大家都公平 雖然要公平 但事情也事有輕重緩急

  7. Linuxprocess scheduling 用了什麼方法?

  8. 就三個字 優先權

  9. Linuxprocess scheduling 的法寶是啥?

  10. Process preemption Heuristic algorithm

  11. 2.6的新特性

  12. Scheduler v2.4 User mode User mode Kernel mode Scheduler v2.6 Kernel mode Kernel mode Process A Process B User mode User mode Scheduler v2.4 Scheduler v2.6

  13. 為啥要讓人家插隊?

  14. 情非得已 大局為重

  15. 插隊的方法?

  16. 當然Process要是個可以執行 • TASK_RUNNING 要有暗號  TIF_NEED_RESCHED

  17. 怎樣的情況下要讓人家插隊?

  18. 老大來了  高優先權的Process 位子佔用得太久了  Exceeds time quantum

  19. 什麼是Time quantum?

  20. 就是把時間分段

  21. 那為什麼要把時間分段

  22. 三個字 趕流行

  23. 那時間要分多少段? 一段又要多長?

  24. 這應該是NP-complete吧!?

  25. 太短會怎樣? 會很累 太長又會怎樣 會等很久

  26. 那到底要怎麼辦?

  27. 看看 Linux kernel 2.6 的作法吧

  28. 這個表有什麼意義嗎?

  29. 可以算出base time quantum Base time quantum = if static priority < 120 (140-static priority)*20 if static priority >= 120 (140-static priority)*5

  30. 什麼是static priority?

  31. 這是要讓一般的process可以區分出優先權用地

  32. 既然有static priority,那有dynamic priority嗎?

  33. 當然有,而且這才是scheduler做scheduling真正的依據當然有,而且這才是scheduler做scheduling真正的依據 Dynamic priority = Max(100, min(static priority – bonus+5, 139))

  34. 這個表又有什麼玄機呢?

  35. dynamic priority<= 3*static priority/4 + 28 • Bonus -5 >= static priority/4 -28 static priority/4 -28 is called interactive delta

  36. 為什麼要判斷他是interactive process?

  37. 一般來說,process可以分成 Interactive process Batch process Real-time process CPU-bound or IO-bound process 要是可以適當的判斷,對於scheduling會有幫助

  38. 那到底scheduling是如何實作的?

  39. 什麼是active process list? 那什麼又是expired process list?

  40. 在說明之前,先來說說kernel 2.4和2.6排程方法上的差異吧!

  41. 那分成active和expired process list 的用意為何?

More Related