ãªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®æŠèŠ
ããã«ã¡ã¯ãHabrïŒ ç§ã®èãã§ã¯ãOSTEPãšããèå³æ·±ãæç®ã®äžé£ã®ç¿»èš³èšäºã«æ³šç®ããããšæããŸãã ãã®èšäºã§ã¯ãunixã«äŒŒããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®åäœãã€ãŸããããã»ã¹ãããŸããŸãªã¹ã±ãžã¥ãŒã©ãã¡ã¢ãªãããã³çŸä»£ã®OSãæ§æããä»ã®åæ§ã®ã³ã³ããŒãã³ãã®åäœã«ã€ããŠè©³ãã説æããŸãã
ããã§èŠãããšãã§ãããã¹ãŠã®è³æã®ãªãªãžãã«ã 翻蚳ã¯å°éçã§ã¯ãªãïŒéåžžã«èªç±ã«ïŒè¡ãããŸããããäžè¬çãªæå³ãä¿æããããšæããŸãã
ãã®ããŒãã®å®éšå®€ã®ä»äºã¯ããã§èŠã€ããããšãã§ããŸãïŒ
ãã®ä»ã®éšåïŒ
ãããŠãããªãã¯
é»å ±ã§ç§ã®ãã£ã³ãã«ãèŠãããšãã§ããŸã=ïŒ
èšç»ïŒãã«ãã¬ãã«ãã£ãŒãããã¯ãã¥ãŒ
ãã®è¬çŸ©ã§ã¯ãæãæåãªã¢ãããŒãã®1ã€ãéçºããåé¡ã«ã€ããŠèª¬æããŸãã
ãã«ãã¬ãã«ãã£ãŒãããã¯ãã¥ãŒ ïŒMLFQïŒãšåŒã°ããèšç»ã MLFQã¹ã±ãžã¥ãŒã©ãŒã¯ã1962幎ã«Fernando J.Corbatóã«ãã£ãŠCompatible Time-Sharing SystemïŒCTSSïŒãšåŒã°ããã·ã¹ãã ã§åããŠèª¬æãããŸããã ãããã®äœåïŒMulticsã«é¢ããåŸã®äœåãå«ãïŒã¯ããã®åŸãã¥ãŒãªã³ã°è³ã«æåºãããŸããã ã¹ã±ãžã¥ãŒã©ã¯ãã®åŸæ¹åãããäžéšã®ææ°ã·ã¹ãã ã§ãã§ã«èŠãããå€èŠ³ãç²åŸããŸããã
MLFQã¢ã«ãŽãªãºã ã¯ã2ã€ã®åºæ¬çãªæšªæçãªåé¡ã解決ããããšããŸãã
æåã« ã圌ã¯ã¿ãŒã³ã¢ã©ãŠã³ãæéã®æé©åãè©Šã¿ãŸããããã¯ãåã®è¬çŸ©ã§æ€èšããããã«ãæçã¿ã¹ã¯ã®ãã¥ãŒã®å
é ããéå§ããããšã«ããæé©åãããŸãã ãã ããOSã¯ãã®ããã»ã¹ãŸãã¯ãã®ããã»ã¹ãã©ã®ãããã®æéæ©èœããããç¥ããŸãããããã¯ãSJFãSTCFã¢ã«ãŽãªãºã ã®æäœã«å¿
èŠãªç¥èã§ãã
次㫠ãMLFQã¯ã·ã¹ãã ïŒãŠãŒã¶ãŒãã¿ã¹ã¯ã®å®äºãåŸ
ã£ãŠããéã«åº§ã£ãŠç»é¢ãèŠã€ããŠãããŠãŒã¶ãŒãªã©ïŒã«ã·ã¹ãã ãå¿çãããå¿çæéãæå°åããããšããŠããŸãã æ®å¿µãªãããRRã®ãããªã¢ã«ãŽãªãºã ã¯å¿çæéãççž®ããŸãããã¿ãŒã³ã¢ã©ãŠã³ãã¿ã€ã ã¡ããªãã¯ã«éåžžã«æªã圱é¿ãåãŒããŸãã ãããã£ãŠãç§ãã¡ã®åé¡ïŒèŠä»¶ãæºãããåæã«ããã»ã¹ã®æ§è³ªã«ã€ããŠäœãç¥ããªãã¹ã±ãžã¥ãŒã©ãäžè¬çã«ã©ã®ããã«èšèšããã®ã§ããããïŒ ã¹ã±ãžã¥ãŒã©ãŒã¯ãèµ·åããã¿ã¹ã¯ã®ç¹æ§ãã©ã®ããã«ããŠåŠç¿ããããã«ãããããè¯ãèšç»æ±ºå®ãäžãããšãã§ããŸããïŒ
åé¡ã®æ¬è³ªïŒå®å
šãªç¥èãªãã«ã¿ã¹ã¯ã®å®åŒåãèšç»ããæ¹æ³ã¯ïŒ 察話åã¿ã¹ã¯ã®å¿çæéãæå°åãããšåæã«ãã¿ã¹ã¯ãå®äºããæéãç¥ããã«æèŠæéãæå°åããã¹ã±ãžã¥ãŒã©ãéçºããæ¹æ³ã¯ïŒæ³šïŒä»¥åã®ã€ãã³ãããåŠã¶
MLFQã©ã€ã³ãããã¯ãéå»ã®ã€ãã³ãããåŠç¿ããŠæªæ¥ãäºæž¬ããã·ã¹ãã ã®åªããäŸã§ãã OSïŒããã³ããŒããŠã§ã¢äºæž¬ãã©ã³ãããã£ãã·ã³ã°ã¢ã«ãŽãªãºã ãå«ãã³ã³ãã¥ãŒã¿ãŒãµã€ãšã³ã¹ã®ä»ã®å€ãã®ãã©ã³ãïŒã§ããåæ§ã®ã¢ãããŒããããèŠãããŸãã ã¿ã¹ã¯ã«è¡å段éãããããããã£ãŠäºæž¬å¯èœãªå Žåãåæ§ã®æ
è¡ãæ©èœããŸãã
ãã ãããã®ãããªææ³ã«ã¯æ³šæãå¿
èŠã§ããäºæž¬ãéåžžã«ç°¡åã«ééã£ãŠããããšãå€æããã·ã¹ãã ããŸã£ããç¥èãæããªãå Žåãããæªãå€æãäžãå¯èœæ§ãããããã§ãã
MLFQïŒåºæ¬ã«ãŒã«
MLFQã¢ã«ãŽãªãºã ã®åºæ¬çãªã«ãŒã«ãèæ
®ããŠãã ããã ãã®ã¢ã«ãŽãªãºã ã«ã¯ããã€ãã®å®è£
ããããŸãããåºæ¬çãªã¢ãããŒãã¯äŒŒãŠããŸãã
æ€èšããå®è£
ã§ã¯ãMLFQã«ããã€ãã®åå¥ã®ãã¥ãŒãããããããããç°ãªãåªå
床ãæã¡ãŸãã ãã€ã§ãå®è¡å¯èœãªã¿ã¹ã¯ã¯1ã€ã®ãã¥ãŒã«ãããŸãã MLFQã¯åªå
é äœã䜿çšããŠãå®è¡ããã¿ã¹ã¯ã決å®ããŸãã åªå
床ã®é«ãã¿ã¹ã¯ïŒåªå
床ã®é«ããã¥ãŒããã®ã¿ã¹ã¯ïŒãæåã«èµ·åãããŸãã
ééããªããè€æ°ã®ã¿ã¹ã¯ãç¹å®ã®ãã¥ãŒã«ååšããå¯èœæ§ãããããããããã®ã¿ã¹ã¯ã®åªå
é äœã¯åãã§ãã ãã®å ŽåãRRãšã³ãžã³ã䜿çšããŠããããã®ã¿ã¹ã¯éã®èµ·åãã¹ã±ãžã¥ãŒã«ããŸãã
ãããã£ãŠãMLFQã®2ã€ã®åºæ¬çãªã«ãŒã«ã«ãªããŸãã
- ã«ãŒã«1ïŒåªå
床ïŒAïŒ>åªå
床ïŒBïŒã®å Žåãã¿ã¹ã¯Aã¯éå§ããŸãïŒBã¯éå§ããŸããïŒ
- ã«ãŒã«2ïŒåªå
床ïŒAïŒ=åªå
床ïŒBïŒã®å ŽåãAïŒBã¯RRã䜿çšããŠéå§ãããŸã
äžèšã«åºã¥ããŠãMLFQèšç»ã®éèŠãªèŠçŽ ã¯åªå
äºé
ã§ãã MLFQã¯ãåã¿ã¹ã¯ã«åºå®ã®åªå
床ãèšå®ãã代ããã«ã芳å¯ãããåäœã«å¿ããŠåªå
床ãå€æŽããŸãã
ããšãã°ãããŒããŒãå
¥åãåŸ
æ©ããŠããéã«ã¿ã¹ã¯ãCPUã§ã®äœæ¥ã絶ããçµäºããå ŽåãMLFQã¯å¯Ÿè©±åããã»ã¹ã®åäœæ¹æ³ã§ãããããããã»ã¹ã®åªå
床ãé«ãã¬ãã«ã«ç¶æããŸãã ããã©ããããã¿ã¹ã¯ãé·æéã«ããã£ãŠCPUã絶ããéäžçã«äœ¿çšããŠããå ŽåãMLFQã¯åªå
é äœãäžããŸãã ãããã£ãŠãMLFQã¯ããã»ã¹ã®åäœæã®åäœã調æ»ãããã®åäœã䜿çšããŸãã
ããæç¹ã§ãã¥ãŒãã©ã®ããã«èŠãããäŸã瀺ããŠã¿ãŸãããããã®åŸã次ã®ãããªçµæãåŸãããŸãã
ãã®ã¹ããŒã ã§ã¯ã2ã€ã®ããã»ã¹AãšBãæé«ã®åªå
床ã§ãã¥ãŒã«ãããŸãã ããã»ã¹Cã¯äžéã®ã©ããã«ãããããã»ã¹Dã¯ãã¥ãŒã®æåŸã«ãããŸãã äžèšã®MLFQã¢ã«ãŽãªãºã ã®èª¬æã«ããã°ãã¹ã±ãžã¥ãŒã©ã¯RRã«åŸã£ãŠæé«ã®åªå
床ã§ã®ã¿ã¿ã¹ã¯ãå®è¡ããã¿ã¹ã¯CãDã¯åäœããªããªããŸãã
åœç¶ãéçãªã¹ãããã·ã§ããã§ã¯ãMLFQãã©ã®ããã«æ©èœããããå®å
šã«ææ¡ããããšã¯ã§ããŸããã
æéã®çµéãšãšãã«ç»åãã©ã®ããã«å€åããããæ£ç¢ºã«ç解ããããšãéèŠã§ãã
è©Šè¡1ïŒåªå
床ãå€æŽããæ¹æ³
ãã®æç¹ã§ãã©ã€ããµã€ã¯ã«äžã«MLFQãã¿ã¹ã¯ã®åªå
床ã¬ãã«ïŒããã³ãã¥ãŒå
ã®ã¿ã¹ã¯ã®äœçœ®ïŒãã©ã®ããã«å€æŽãããã決å®ããå¿
èŠããããŸãã ãããè¡ãã«ã¯ãã¯ãŒã¯ãããŒãèŠããŠããå¿
èŠããããŸãïŒçãå®è¡æéïŒãããã£ãŠCPUã®é »ç¹ãªãªãªãŒã¹ïŒãæã€å€æ°ã®å¯Ÿè©±åã¿ã¹ã¯ãšãCPUããã¹ãŠã®äœæ¥æéã§äœ¿çšããããã€ãã®é·ãã¿ã¹ã¯ã§ããããã®ãããªã¿ã¹ã¯ã®å¿çæéã¯éèŠã§ã¯ãããŸããã ãããã£ãŠã次ã®ã«ãŒã«ã䜿çšããŠMLFQã¢ã«ãŽãªãºã ãå®è£
ããæåã®è©Šè¡ãè¡ãããšãã§ããŸãã
- ã«ãŒã«3ïŒã¿ã¹ã¯ãã·ã¹ãã ã«å
¥ããšãæé«ã®ãã¥ãŒã«å
¥ããããŸã
- åªå
é äœã
- Rule4aïŒã¿ã¹ã¯ãå²ãåœãŠãããæéæ å
šäœã䜿çšããå Žåã
- åªå
床ãäžãããŸãã
- Rule4bïŒã¿ã€ã ãŠã£ã³ããŠãåããåã«ã¿ã¹ã¯ãCPUã解æŸããå Žåã
- åãåªå
床ã®ãŸãŸã§ãã
äŸ1ïŒåäžã®é·æéå®è¡ã¿ã¹ã¯ãã®äŸã§ãããããã«ãå
¥å Žæã®ã¿ã¹ã¯ã¯æé«ã®åªå
床ã§æ瀺ãããŸãã 10ããªç§ã®ã¿ã€ã ãŠã£ã³ããŠã®åŸãã¹ã±ãžã¥ãŒã©ã«ãã£ãŠããã»ã¹ã®åªå
床ãäžããããŸãã 次ã®æéæ ã®åŸãã¿ã¹ã¯ã¯æçµçã«ã·ã¹ãã å
ã§æãäœãåªå
床ã«èœã¡ãããã§æ®ããŸãã
äŸ2ïŒåœŒãã¯çãã¿ã¹ã¯ãæã¡åºããŸãã次ã«ãMLFQãSJFã«è¿ã¥ãããšããæ¹æ³ã®äŸãèŠãŠã¿ãŸãããã ãã®äŸã«ã¯2ã€ã®ã¿ã¹ã¯ããããŸããAã¯CPUãåžžã«å æããé·æéå®è¡ãããã¿ã¹ã¯ã§ãããBã¯çã察話åã¿ã¹ã¯ã§ãã ã¿ã¹ã¯Bãå°çãããŸã§ã«ãAããã§ã«ãã°ããåããŠãããšããŸãã
ã¹ã¯ãªããã®çµæã¯ããã®ã°ã©ãã«è¡šç€ºãããŸãã ã¿ã¹ã¯Aã¯ãCPUã䜿çšããä»ã®ã¿ã¹ã¯ãšåæ§ã«ãäžçªäžã«ãããŸãã ã¿ã¹ã¯Bã¯T = 100ã«å°çããåªå
床ãæãé«ããã¥ãŒã«é
眮ãããŸãã 圌女ã®äœåã®æéã¯çããããæçµæ®µéã«éããåã«çµäºããŸãã
ãã®äŸãããã¢ã«ãŽãªãºã ã®äž»ãªç®æšãç解ããå¿
èŠããããŸããã¢ã«ãŽãªãºã ã¯é·ãã¿ã¹ã¯ãçãã¿ã¹ã¯ãç¥ããªãããããŸãã¿ã¹ã¯ãçããšä»®å®ããæé«ã®åªå
é äœãäžããŸãã ãããæ¬åœã«çãã¿ã¹ã¯ã§ããå Žåãããã¯ããã«å®äºããŸããããã§ãªãå Žåããããé·ãã¿ã¹ã¯ã§ããå Žåãåªå
床ããã£ããäžã«ç§»åããããã«å¿çãå¿
èŠãšããªãæ¬åœã«é·ãã¿ã¹ã¯ã§ããããšã蚌æããŸãã
äŸ3ïŒI / Oã¯ã©ãã§ããïŒæ¬¡ã«ãI / Oã®äŸãèŠãŠã¿ãŸãããã ã«ãŒã«4bã§è¿°ã¹ãããã«ãããã»ã¹ãããã»ããµæéãå®å
šã«å©çšããã«ããã»ããµã解æŸããå Žåãããã»ã¹ã¯åãåªå
床ã¬ãã«ã®ãŸãŸã§ãã ãã®ã«ãŒã«ã®æå³ã¯éåžžã«åçŽã§ããããšãã°ããŠãŒã¶ãŒãããŒãŸãã¯ããŠã¹ãæŒãã®ãåŸ
ã€ãªã©ã察話åã¿ã¹ã¯ãå€æ°ã®I / Oæäœãå®è¡ããå Žåããã®ãããªã¿ã¹ã¯ã¯å²ãåœãŠããããŠã£ã³ããŠã®åã«ããã»ããµã解æŸããŸãã ãã®ãããªã¿ã¹ã¯ãåªå
ããŠçç¥ããããªããããåãã¬ãã«ã®ãŸãŸã«ãªããŸãã
ãã®äŸã¯ããã®ãããªããã»ã¹ã§ã¢ã«ãŽãªãºã ãã©ã®ããã«æ©èœãããã瀺ããŠããŸããI/ Oããã»ã¹ãå®è¡ããåã«1msã ãCPUãå¿
èŠãšãã察話åã¿ã¹ã¯Bãšãåžžã«CPUã䜿çšããé·ãã¿ã¹ã¯Aã§ãã
MLFQã¯åžžã«ç¶ç¶ãããããããã»ã¹Bãæé«ã®åªå
床ã§ä¿æããŸãã
CPUã解æŸããŸãã Bã察話åã¿ã¹ã¯ã®å Žåãã¢ã«ãŽãªãºã ã¯å¯Ÿè©±åã¿ã¹ã¯ããã°ããèµ·åãããšããç®æšãéæããŸããã
çŸåšã®MLFQã¢ã«ãŽãªãºã ã®åââé¡åã®äŸã§ã¯ãMLFQã®åºæ¬ããŒãžã§ã³ãæ§ç¯ããŸããã ãããŠãé·ãã¿ã¹ã¯éã§ããã»ããµæéãèª å®ã«åé
ããçãã¿ã¹ã¯ãéäžçã«I / Oã«ã¢ã¯ã»ã¹ããã¿ã¹ã¯ãè¿
éã«åäœã§ããããã«ãããŸããæ£çŽã«ä»äºãããŠããããã§ãã æ®å¿µãªããããã®ã¢ãããŒãã«ã¯ããã€ãã®é倧ãªåé¡ããããŸãã
ãŸã ã空è
¹ã®åé¡ïŒã·ã¹ãã ã«å€ãã®å¯Ÿè©±åã¿ã¹ã¯ãããå Žåããããã¯ãã¹ãŠã®ããã»ããµãŒæéãæ¶è²»ãããããåäžã®é·ãã¿ã¹ã¯ãå®è¡ã§ããŸããïŒé£¢ããŠããŸãïŒã
第äºã« ãè³¢ããŠãŒã¶ãŒã¯èªåã®ããã°ã©ã ãæžããŠã
ãã©ã³ããŒãã ãŸãã ããªãã¯ã¯äœããããããšã§ã
ããã»ã¹ã«ããå€ãã®ããã»ããµæéãäžããã¹ã±ãžã¥ãŒã©ã ã¢ã«ãŽãªãºã
äžèšã®ãããªæ»æã¯ããã®ãããªæ»æã«å¯ŸããŠéåžžã«è匱ã§ãïŒæéæ ãå®è³ªçã«åããå
I / Oæäœãå®è¡ããå¿
èŠããããŸããïŒã©ã®ãã¡ã€ã«ã«é¢ä¿ãªããäžéšã«å¯ŸããŠïŒ
ãããã£ãŠãCPUã解æŸããŸãã ãã®åäœã«ãããåãç¶æ
ãä¿ã€ããšãã§ããŸã
ãã¥ãŒèªäœãCPUæéã®å²åã倧ãããªããŸãã å®äºããã
ããã¯æ£ããã§ãïŒããšãã°ãCPUã解æŸããåã®ãŠã£ã³ããŠæéã®99ïŒ
ïŒ
ãã®ãããªã¿ã¹ã¯ã¯ãããã»ããµãåçŽã«ç¬å ã§ããŸãã
æåŸã«ãããã°ã©ã ã¯æéãšãšãã«ãã®åäœãå€æŽã§ããŸãã ãããã®ã¿ã¹ã¯
CPUã䜿çšãããŠãŒã¶ãŒã¯ã€ã³ã¿ã©ã¯ãã£ãã«ãªããŸãã ãã®äŸã§ã¯ãåæ§ã®
ä»ã®äººãåãåãããã«ãã¿ã¹ã¯ã¯ã¹ã±ãžã¥ãŒã©ããé©åãªåŠçãåããŸãã
ïŒåæïŒå¯Ÿè©±åã¿ã¹ã¯ã
èŽè¡ãžã®è³ªåïŒçŸä»£äžçã§ã¯ããã©ã³ããŒã«å¯Ÿããã©ããªæ»æãå¯èœã§ããããïŒ
è©Šè¡2ïŒåªå
床ãäžãã
ã«ãŒã«ãå€æŽããŠãåé¡ãåé¿ã§ãããã©ããã確èªããŸããã
æé£ã ãã®é¢é£æ§ã確ä¿ããããã«ç§ãã¡ã«ã§ããããš
CPUã¿ã¹ã¯ã¯æéãååŸããŸãïŒé·ããªãå Žåã§ãïŒã
åé¡ã®ç°¡åãªè§£æ±ºçãšããŠãå®æçã«æäŸããããšãã§ããŸã
ã·ã¹ãã å
ã®ãã®ãããªãã¹ãŠã®ã¿ã¹ã¯ã®åªå
床ãäžããŸãã å€ãã®æ¹æ³ããããŸãã
ãããéæããããã«ãäŸãšããŠç°¡åãªãã®ã翻蚳ããŠã¿ãŸãããïŒç¿»èš³
ãã¹ãŠã®ã¿ã¹ã¯ãäžåºŠã«æé«ã®åªå
床ã§ããããã£ãŠæ°ããã«ãŒã«ïŒ
- ã«ãŒã«5 ïŒSã®äžå®æéåŸãã·ã¹ãã å
ã®ãã¹ãŠã®ã¿ã¹ã¯ãæé«ã®åªå
床ã«è»¢éããŸãã
æ°ããã«ãŒã«ã¯ã2ã€ã®åé¡ãåæã«è§£æ±ºããŸãã ãŸããããã»ã¹
飢ããªãããšãä¿èšŒïŒæãåªå
床ã®é«ãã¿ã¹ã¯ãå
±æãããŸã
RRã¢ã«ãŽãªãºã ã«ããããã»ããµæéããããã£ãŠãã¹ãŠã®ããã»ã¹ãåä¿¡ããŸã
ããã»ããµãŒæéã 第äºã«ã以åã«äœ¿çšããããã»ã¹ãããå Žå
ããã»ããµã®ã¿ãã€ã³ã¿ã©ã¯ãã£ãã«ãªããããé«ãããã»ããµãšäžèŽãããŸãŸã«ãªããŸã
åªå
床ãäžåºŠé«ããªããšãåªå
床ãæãé«ããªããŸãã
äŸãèããŠã¿ãŸãããã ãã®ã·ããªãªã§ã¯ã1ã€ã®ããã»ã¹ã䜿çšããŠæ€èšããŸã
CPUãš2ã€ã®å¯Ÿè©±åã®çãããã»ã¹ã å³ã®å·ŠåŽã®å³ã¯ãåªå
é äœãäžããªãå Žåã®åäœã瀺ããŠããããã2ã€ã®å¯Ÿè©±åã¿ã¹ã¯ãã·ã¹ãã ã«å°çããåŸãé·ãã¿ã¹ã¯ã¯é£¢ãå§ããŸãã å³åŽã®å³ã§ã¯ã50ããªç§ããšã«åªå
床ãäžããããããã¹ãŠã®ããã»ã¹ãããã»ããµæéãåãåãããšãä¿èšŒãããå®æçã«éå§ãããŸãã ãã®å Žåã®50ããªç§ãäŸãšããŠæ¡çšãããŠããŸãããå®éã«ã¯ãã®æ°ã¯ããã¶ã倧ããã§ãã
æããã«ãSã®åšæçãªå¢å æéã®è¿œå ã¯ã
è«ççãªè³ªåïŒã©ã®å€ãèšå®ããå¿
èŠããããŸããïŒ åèªãã
ã·ã¹ãã ãšã³ãžãã¢ã®John Ousterhoutã¯ãvoo-dooã®ãããªã·ã¹ãã ã§åæ§ã®éãåŒã³åºããŸãã
圌ãã¯äœããã®æ¹æ³ã§æ£ããããã«é»éè¡ãå¿
èŠãšãããããå®æ°
åºåäžã æ®å¿µãªãããSã«ã¯ãã®ãããªéŠãããããŸãã å€ãèšå®ããå Žå
倧ããª-é·ãã¿ã¹ã¯ã¯é£¢ãå§ããŸãã èšå®ããå€ãäœããããšã
ã€ã³ã¿ã©ã¯ãã£ããªã¿ã¹ã¯ã¯ãé©åãªããã»ããµæéãåãåããŸããã
è©Šè¡3ïŒãã¹ãã¢ã«ãŠã³ãã£ã³ã°
解決ããå¿
èŠããããã1ã€ã®åé¡ããããŸãã
ãã©ã³ããŒãcheããŸããããïŒ ãã®æ©äŒã®æ眪ã¯
ã«ãŒã«4aã4bãã¿ã¹ã¯ãåªå
床ãç¶æããããã»ããµã解æŸã§ããããã«ããŸã
å²ãåœãŠãããæéã®æºäºåã ããã«å¯ŸåŠããæ¹æ³ã¯ïŒ
ãã®å Žåã®ãœãªã¥ãŒã·ã§ã³ã¯ãããããã®CPUæéã®æé©ãªã¢ã«ãŠã³ãã£ã³ã°ãšèŠãªãããšãã§ããŸã
MLFQã¬ãã«ã ããã°ã©ã ã䜿çšããæéãå¿ãã代ããã«
å²ãåœãŠãããæéã®ããã»ããµããããèæ
®ããä¿åããå¿
èŠããããŸãã åŸ
ããã»ã¹ã«è²»ããããæéã¯æ¬¡ã®æéã«ççž®ãããã¹ãã§ã
åªå
ã¬ãã«ã ããã»ã¹ããã®æéãã©ã®ããã«äœ¿çšãããã«é¢ä¿ãªã-ã©ã®ããã«
絶ããããã»ããµãŒäžã§èšç®ããããåããããå€ãã®åŒã³åºãã ãã®ããã«
ã«ãŒã«4ã¯æ¬¡ã®ããã«æžãæããå¿
èŠããããŸãã
- ã«ãŒã«4 ïŒã¿ã¹ã¯ãçŸåšã®ãã¥ãŒã§å²ãåœãŠãããæéã䜿ãæãããåŸïŒCPUã解æŸããåæ°ã«é¢ä¿ãªãïŒããã®ãããªã¿ã¹ã¯ã®åªå
床ã¯äœäžããŸãïŒãã¥ãŒãäžã«ç§»åããŸãïŒã
äŸãèŠãŠã¿ãŸãããïŒ
ã
ãã®å³ã¯ãã¹ã±ãžã¥ãŒã©ãã ãŸãããšãããšã©ããªããã瀺ããŠããŸãã
åã®ã«ãŒã«4aã4bã§ãã£ãå Žåãå·ŠåŽã«çµæã衚瀺ãããŸãã ããããŒãã¥ãŒ
ã«ãŒã«ã¯å³åŽã®çµæã§ãã ä¿è·ã®åã«ãããã»ã¹ã¯å®äºãŸã§I / OãåŒã³åºãã
ãããã£ãŠãåäœã«é¢ä¿ãªããä¿è·ãæå¹ã«ããåŸãCPUãæ¯é
ããŸã
I / Oãããã¯ãŸã ã©ã€ã³ãããããããŠã³ãããããã£ãŠäžæ£ã§ã¯ãããŸãã
CPUãªãœãŒã¹ãå æããŸãã
MLFQããã³ãã®ä»ã®åé¡ã®æ¹å
äžèšã®æ¹åã«ãããæ°ããåé¡ãçºçããŸãã
質å-ãã®ãããªã¹ã±ãžã¥ãŒã©ããã©ã¡ãŒã¿åããæ¹æ³ã¯ïŒ ã€ãŸã ãããã§ãã
ããŒã¹ãïŒ ãã¥ãŒå
ã®ããã°ã©ã ãŠã£ã³ããŠã®ãµã€ãºã¯ã©ããããã§ããïŒ ã©ããã£ãŠ
飢starãé¿ããããã«ãããã°ã©ã ã®åªå
床ãäžããå¿
èŠããããŸãã
ããã°ã©ã ã®åäœã®å€åãèæ
®ããŸããïŒ ãããã®è³ªåã«ã¯ãç°¡åãªããšã¯ãããŸãã
å¿çãšãè² è·ããã³ãã®åŸã®èšå®ã«ããå®éšã®ã¿
èšç»è
ã¯ãæºè¶³ã®ãããã©ã³ã¹ããšãããšãã§ããŸãã
ããšãã°ãã»ãšãã©ã®MLFQå®è£
ã§ã¯ãç°ãªã
ç°ãªããã¥ãŒãžã®æéééã éåžžãé«åªå
床ãã¥ãŒ
çãééãå²ãåœãŠãããŸãã ãããã®ãã¥ãŒã¯ã€ã³ã¿ã©ã¯ãã£ããªã¿ã¹ã¯ã§æ§æããã
åãæ¿ãã¯éåžžã«ææã§ããã10以äžãèŠãã
ããªç§ 察ç
§çã«ãäœåªå
床ãã¥ãŒã¯ã次ã䜿çšããé·ãã¿ã¹ã¯ã§æ§æãããŸã
CPU ãã®å Žåãé·ãæéééã¯éåžžã«ããŸãé©åããŸãïŒ100ããªç§ïŒã
ãã®äŸã§ã¯ãé«åªå
床ãã¥ãŒã§æ©èœãã2ã€ã®ã¿ã¹ã¯ããããŸã20
ããªç§ã10ããªç§éWindowsã§ç Žæã äžçšåºŠã®ãã¥ãŒïŒ20msã®ãŠã£ã³ããŠïŒããã³äœåªå
床ã§40ms
ãã¥ãŒæéæ ã¯40ããªç§ã«ãªããã¿ã¹ã¯ãäœæ¥ãå®äºããŸããã
Solarisã®MLFQå®è£
ã¯ãã¿ã€ã ã·ã§ã¢ãªã³ã°ã¹ã±ãžã¥ãŒã©ã®ã¯ã©ã¹ã§ãã
ã¹ã±ãžã¥ãŒã©ãŒã¯ãã©ã®ããã«ãã¹ãããæ£ç¢ºã«æ±ºå®ããããŒãã«ã®ã»ãããæäŸããŸã
ããã»ã¹ã®åç¶æéã®åªå
床ãå€æŽããŸãããµã€ãºã¯ã©ãããã¹ãã§ãã
éžæãããŠã£ã³ããŠãšãã¿ã¹ã¯ã®åªå
床ãäžããå¿
èŠãããé »åºŠã 管çè
ã·ã¹ãã ã¯ãã®ããŒãã«ãšå¯Ÿè©±ããŠãã¹ã±ãžã¥ãŒã©ãåäœãããããšãã§ããŸã
å¥ã®æ¹æ³ã§ã ããã©ã«ãã§ã¯ããã®ããŒãã«ã«ã¯60åã®å¢åãã¥ãŒããããŸãã
20ããªç§ïŒé«åªå
床ïŒããæ°çŸããªç§ïŒæäœåªå
床ïŒã®ãŠã£ã³ããŠãµã€ãº
ãŸãããã¹ãŠã®ã¿ã¹ã¯ã1ç§ã«1åããŒã¹ããããŸãã
ä»ã®MLFQãã©ã³ããŒã¯ãããŒãã«ãŸãã¯ç¹å®ã®
ãã®è¬çŸ©ã§èª¬æãããŠããã«ãŒã«ã¯ãéã«ã
æ°åŒã ãã®ãããããšãã°ãFreeBSDã®ã¹ã±ãžã¥ãŒã©ã¯æ¬¡ã®åŒã䜿çšããŸã
ããã»ã¹ã®éã«åºã¥ããŠã¿ã¹ã¯ã®çŸåšã®åªå
床ãèšç®ãã
䜿çšãããCPUã ããã«ãCPUã®äœ¿çšã¯æéãšãšãã«æžè¡°ããããã
ãããã£ãŠãåªå
床ã®å¢å ã¯ãäžèšãšã¯å€å°ç°ãªããŸãã ããã§ã
æžè¡°ã¢ã«ãŽãªãºã ãšåŒã°ããŸãã ããŒãžã§ã³7.1以éãFreeBSDã¯ULEã¹ã±ãžã¥ãŒã©ã䜿çšããŠããŸãã
æåŸã«ãå€ãã®ãã©ã³ããŒã«ã¯ä»ã®æ©èœããããŸãã ããšãã°ã
ã¹ã±ãžã¥ãŒã©ã¯ããªãã¬ãŒãã£ã³ã°ã·ã¹ãã ã®æé«ã¬ãã«ãäºçŽããŸãã
ãã®ãããã©ã®ãŠãŒã¶ãŒããã»ã¹ãæé«ã®åªå
床ãåŸãããšãã§ããŸãã
ã·ã¹ãã ã äžéšã®ã·ã¹ãã ã§ã¯ãæ¯æŽããããã«ã¢ããã€ã¹ãæäŸã§ããŸãã
ã¹ã±ãžã¥ãŒã©ãŒãåªå
é äœãæ£ããèšå®ããŸãã ããšãã°ã
niceã³ãã³ãã䜿çšãã
ã¿ã¹ã¯ã®åªå
床ãäžãããäžãããããããšãã§ããŸã
ããã»ããµæéã®ããã°ã©ã ã®å¯èœæ§ãæžãããŸãã
MLFQïŒæŠèŠ
MLFQãšåŒã°ããèšç»ã¢ãããŒãã«ã€ããŠèª¬æããŸããã 圌ã®åå
ä»äºã®ååã§çµè«-ããã¯ããã€ãã®ãã¥ãŒãæã¡ããã£ãŒãããã¯ã䜿çšããŸã
ã¿ã¹ã¯ã®åªå
床ã決å®ããŸãã
ã«ãŒã«ã®æçµåœ¢åŒã¯æ¬¡ã®ãšããã§ãã
- ã«ãŒã«1 ïŒåªå
床ïŒAïŒ>åªå
床ïŒBïŒã®å Žåãã¿ã¹ã¯Aã¯éå§ããŸãïŒBã¯éå§ããŸããïŒ
- ã«ãŒã«2 ïŒåªå
床ïŒAïŒ=åªå
床ïŒBïŒã®å ŽåãRRã䜿çšããŠAïŒBãéå§ãããŸã
- ã«ãŒã«3 ïŒã¿ã¹ã¯ãã·ã¹ãã ã«å
¥ããšãæãé«ãåªå
床ã§ãã¥ãŒã«å
¥ããããŸãã
- ã«ãŒã«4 ïŒã¿ã¹ã¯ãçŸåšã®ãã¥ãŒã§å²ãåœãŠãããæéã䜿ãæãããåŸïŒCPUã解æŸããåæ°ã«é¢ä¿ãªãïŒããã®ãããªã¿ã¹ã¯ã®åªå
床ã¯äœäžããŸãïŒãã¥ãŒãäžã«ç§»åããŸãïŒã
- ã«ãŒã«5 ïŒSã®äžå®æéåŸãã·ã¹ãã å
ã®ãã¹ãŠã®ã¿ã¹ã¯ãæé«ã®åªå
床ã«è»¢éããŸãã
MLFQã¯æ¬¡ã®çç±ã§èå³æ·±ã-ã®ç¥èãèŠæ±ãã代ããã«
äºåã«ã¿ã¹ã¯ã®æ§è³ªãã¢ã«ãŽãªãºã ã¯ã¿ã¹ã¯ã®éå»ã®åäœã調æ»ããèšå®ããŸã
ããã«å¿ããŠåªå
é äœã ãããã£ãŠã圌ã¯äžåºŠã«2ã€ã®æ€
åã«åº§ãããšããŸã-å°ããªã¿ã¹ã¯ïŒSJFãSTCFïŒã®ããã©ãŒãã³ã¹ãéæããæ£çŽã«é·ãå®è¡ããããã«ã
CPUèªã¿èŸŒã¿ãžã§ãã ãããã£ãŠãBSDããã³ãã®æŽŸçç©ãå«ãå€ãã®ã·ã¹ãã ã¯ã
SolarisãWindowsãMacã¯ã¹ã±ãžã¥ãŒã©ãšããŠäœããã®åœ¢åŒã®ã¢ã«ãŽãªãºã ã䜿çšããŸã
ããŒã¹ãã¬ãŒã ã¯ãŒã¯ãšããŠã®MLFQã
è¿œå è³æïŒ
- manpages.debian.org/stretch/manpages/sched.7.en.html
- en.wikipedia.org/wiki/Scheduling_ ïŒã³ã³ãã¥ãŒãã£ã³ã°ïŒ
- pages.lip6.fr/Julia.Lawall/atc18-bouron.pdf
- www.usenix.org/legacy/event/bsdcon03/tech/full_papers/roberson/roberson.pdf
- chebykin.org/freebsd-process-scheduling