????cgroup ???????
????linux????????control group?????cgroup??since linux 2.6.24??????????????????飬??????????????????????磺group-1???30%??CPU??50%?????IO??group-2???10%??CPU??20%?????IO?????????????cgroup????????
????cgroup????????????????CPU???????????????????????????
????linux????У?????????????????????????????????linux???????????????????????A??B???????????????????????????????????????????A??B?????????CPU???????????????A???make -j8??8????????make?????????B??????make??????????????make??????????????????????A?????make????????8????B??????????????????????£?8????B?????CPU??????????????????????A????????????????????????????ж?CPU?????????
??????α??A??B??????????CPU????????????????????????????A??B???????????飬?????????????????????????飬?????е???????????????????С?????????鱻??е??????????????A??B????????50%??CPU??
????????????

??????linux????У????task_group???????????????顣???д????task_group???????????????cgroup??????????????
???????task_group??????????????????????????????????????????????????????????????task_group????????????????????????????????????????????????????????????????????ж??У?????????CPU??????????????????????ж????У????????task_group??????????????????丸task_group?????ж??С?
?????????е?????????????????????????????????task_group??task?????????????????????????????????????????????task_group????????my_q??????????????????????ж??У?????my_q????NULL????????????task??????????????my_q??????X_rq???????????????????cfs_rq????????????rt_rq???????????????????????ж??У??????????????????????????????????????ж??У??????????????????????????ж??С?
????????????????????ж???????????????????????????????????????task_group?????????????????????????????????task?????TASK_RUNNING?????????????????ж?????????????????в?????TASK_RUNNING??????????????饗??????????壩?????????????????????ж??С??????????????鴴???????????task_group???????????task_group??????????У????????????????????????????ж??к?????????????????У????????????????????TASK_RUNNING????????
?????????????task_group????е???????????????????????????ж??г?????????????????????壨?????????????????е????????????????????????????????壩???????task_group??????????ж??б?????????rq???У???????????????????ж????????????Щ?????????????Ρ?
?????????????????????????task_group?????ж?????????????????塣???????????????????task_group???????????????????????????ж??м???????????????塣?????????????????????????????task_group?????ж?????????????????????????????????????????task_group????????ж???????????????????岻???????丸??????????ж????С?
?????????????task_group???????????????????ж??ж????CPU??????????task_group???????????????????????CPU??????????ж??С???????task??????????????????????????а?CPU?????????????????????????????task????????????????CPU??????????ж???????????????μ???linux???SMP??????????????
?????????????
???????????????????????????????????????????????????????task???????????????????????? or ???????????????????????????????????ж????е?????????????task_group??task???????????????????壬?????????????task_group????????????ζ???????????????????嵽?????????????????????????????????巽???????????????????rt???????????cfs????????????????????
????????????????
???????linux????????????????????????????????CPU??????????????????????????????????????????????????????????????????????????????????????????С?
??????????????????????????????“???????????????????е??????”?????????????????????????10??20??30??????????????????10??????С??????????
?????????????????壬????????????????????task??????????????????????????????????????????????????????????????????????????????????????????task???????????????????????????
????????????????????????task_group???????????????????????????????·???????????TASK_RUNNING???????????????????????????????????????????????????????????????????????????黹????????????????????????????????????鶼??“??????TASK_RUNNING????????????????????????????”??????????????Щ??……
???????????????????linux???е?????proc?????/proc/sys/kernel/sched_rt_period_us??/proc/sys/kernel/sched_rt_runtime_us????????????漲???????sched_rt_period_us?????????????????????????????????????????sched_rt_runtime_us???????????????????1s??0.95s?????????????????????????????У??????????????е??????????0.95????μ?????0.05????????????????????????????в?????95%??CPU??????????????????????????????????????????????????linux????????????????????????????????????д???TASK_RUNNING????????????????????????????????С?????sched_rt_runtime_us????sched_rt_period_us??
??????????sched_rt_runtime_us??sched_rt_period_us???????????????????????CPU??а???????????????????????????????????????????????????????????????飬?????????????20ms???????????????????????40ms??????????????????????????????????????CPU??б????????????????????
?????????????????sched_rt_runtime_us??sched_rt_period_us??????????????task_group?????????sched_rt_runtime_us??sched_rt_period_us????????????????????sched_rt_period_us?????????????????????sched_rt_runtime_us????????CPU??б??sched_rt_runtime_us/sched_rt_period_us??
?????????????task_group??????sched_rt_runtime_us??sched_rt_period_us????????????proc????е?????????????task_group????????????????????n???????????m??TASK_RUNNING????????????CPU??б??A????n???????CPU??б??B????B????С?????A????A-B??μ?CPU??佫?????m??TASK_RUNNING?????????????????????CPU??б??????????????????????????????????
??????????sched_rt_runtime_us??sched_rt_period_us???????????????????????????????????????????????ж???????????£?????????????????弰?????????????????????runtime??????????????????sched_rt_runtime_us??????????????????????ж???????????????????rt_rq??throttled????????????£????rt_rq??????????岻????ν??????ж??С??????rt_rq???????????????????????????????sched_rt_period_us????ζ????????????????????????rt_rq??runtime??????sched_rt_period_us??λ????????????runtime??С??0???????rt_rq??throttled???л????????
??????????????????????????????£??????????????????????????????0.95???????????????CPU????????0.95?????????0??С??0.95????????μ???????????????????????????????CPU?????????0.95?????????????0.95????μ?0.05???????????????????????????0.05????????κ??????????????CPU???????TASK_RUNNING??????????????????????????????????CPU??????????????????????г???0.95??????????????μ?0.05?????????????CPU????????????????????á????sched_rt_runtime_us??sched_rt_period_us????????????
???????ж?CPU??????????????????????task_group????????????????ж??????CPU??????????sched_rt_runtime_us??sched_rt_period_us?????????????????.?????????????N??CPU??????????????CPU??????N*sched_rt_runtime_us/sched_rt_period_us????????????????????????????????????????????????0.95??????????????????????????CPU?????????????????????????CPU???????????????????????????????????????????????е??CPU?????????????????????CPU???????????????????95%?????????????????????????CPU????????????????л????????Ч?????????????CPU???????????????????CPU?????????????????????????????????????sched_rt_runtime_us??????????????????????