Linux????????
???????????? ???????[ 2016/9/29 15:08:14 ] ?????????????? Linux
?????????????????
???????????????????A??B????????????????????????????????CPU?????????????????????????????????????????????????????????????????????????
????????????????????????????????????????鱻????????????????????????壬?????????????????????????????????????????????????????????????????????????????????????????????????鱻???????????????Щ??????????????????
????????????????????????task_group???????shares???????????????sched_rt_runtime_us??sched_rt_period_us???????????У???shares????????????????????????????????CFS?????????淨(jìng)?????????????????????????????????????????????????????????????????????????????shares?????????????
????shares????????????????????????????????????????????????????£????????????CPU???
???????
????????????ubuntu 10.04??kernel 2.6.32??Intel Core2 ????
????????????????CPU?????cgroup????????grp_a??grp_b???????飺
????kouu@kouu-one:~$ sudo mkdir /dev/cgroup/cpu -p
????kouu@kouu-one:~$ sudo mount -t cgroup cgroup -o cpu /dev/cgroup/cpu
????kouu@kouu-one:/dev/cgroup/cpu$ cd /dev/cgroup/cpu/
????kouu@kouu-one:/dev/cgroup/cpu$ mkdir grp_{a??b}
????kouu@kouu-one:/dev/cgroup/cpu$ ls *
????cgroup.procs cpu.rt_period_us cpu.rt_runtime_us cpu.shares notify_on_release release_agent tasks
????grp_a:
????cgroup.procs cpu.rt_period_us cpu.rt_runtime_us cpu.shares notify_on_release tasks
????grp_b:
????cgroup.procs cpu.rt_period_us cpu.rt_runtime_us cpu.shares notify_on_release tasks
???????????shell???????????grp_a????????????grp_b??
????kouu@kouu-one:~/test/rtproc$ cat ttt.sh
????echo $1 > /dev/cgroup/cpu/$2/tasks
????????????ttt.sh??дcgroup?μ?tasks?????????д?????????root???????shell???root??????sudo?????豻????е?????root???????sudo sh??????????????shell???????echo??????????????
????kouu@kouu-one:~/test1$ echo $$
????6740
????kouu@kouu-one:~/test1$ sudo sh ttt.sh $$ grp_a
????kouu@kouu-one:~/test2$ echo $$
????9410
????kouu@kouu-one:~/test2$ sudo sh ttt.sh $$ grp_b
????kouu@kouu-one:~/test3$ echo $$
????9425
????kouu@kouu-one:~/test3$ sudo sh ttt.sh $$ grp_b
???????cgroup???£????????shell???????????
????kouu@kouu-one:/dev/cgroup/cpu$ cat grp_a/tasks
????6740
????kouu@kouu-one:/dev/cgroup/cpu$ cat grp_b/tasks
????9410
????9425
???????????????????shell????????????????????a.out???????????CPU????????????????????????????
????#define _GNU_SOURCE
????#include
????int main()
????{
????cpu_set_t set;
????CPU_ZERO(&set);
????CPU_SET(1?? &set);
????sched_setaffinity(0?? sizeof(cpu_set_t)?? &set);
????while(1);
????return 0;
????}
????????????a.out???????????????shell?з?????С?????shell????fork???????????????a.out????Щ???????????丸?????cgroup????????????top??£???????????grp_a??a.out???50%??CPU????????grp_b??????a.out???25%??CPU???????????50%????
????kouu@kouu-one:/dev/cgroup/cpu$ top -c
????......
????PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
????19854 kouu 20 0 1616 328 272 R 50 0.0 0:11.69 ./a.out
????19857 kouu 20 0 1616 332 272 R 25 0.0 0:05.73 ./a.out
????19860 kouu 20 0 1616 332 272 R 25 0.0 0:04.68 ./a.out
????......
?????????????????????????a.out??????????£?
????#define _GNU_SOURCE
????#include
????int main()
????{
????int prio = 50;
????sched_setscheduler(0?? SCHED_FIFO?? (struct sched_param*)&prio);
????while(1);
????return 0;
????}
???????????grp_a??rt_runtime???
????kouu@kouu-one:/dev/cgroup/cpu$ sudo sh
????# echo 300000 > grp_a/cpu.rt_runtime_us
????# exit
????kouu@kouu-one:/dev/cgroup/cpu$ cat grp_a/cpu.rt_*
????1000000
????300000
???????????????????????????????grp_a???????????????????300????????a.out???????????????root?????????top??????
????kouu@kouu-one:/dev/cgroup/cpu$ top -c
????......
????Cpu(s): 31.4%us?? 0.7%sy?? 0.0%ni?? 68.0%id?? 0.0%wa?? 0.0%hi?? 0.0%si?? 0.0%st
????......
????PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
????28324 root -51 0 1620 332 272 R 60 0.0 0:06.49 ./a.out
????......
?????????????CPU??????????????????a.out??????á????????????a.out????CPU?????60%??????30%??
????????
??????????????“200+??Kernel????????????Linux????????”???????????????????????????????μ???????????????????????????????????????????????TTY??task_group?????н??????????????????????TTY???С????????????????飬?????????Xwindow????????TTY????????????α??????????????TTY??????????????????е????????????make -j64???????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????????TASK_RUNNING?????????????????????????????????????
???????????????????????漰???????????????????SPASVOС??(021-61079698-8054)?????????????????????????
??????
Linux??????DDR????????????Linux?????????????????豸??????????linux???в???????????м??????????????????????????Linux????Linux??DNS????????????γ???????????Linux?????????????Linux????(???)????????Linux ????????????????????????????????Windows???У?Linux???????Linux????????????????Linux iommu??vfio???????Linux????ε???TCP???????Linux?????????????СLinux?·???????????Linux???Jexus?й?Asp.Net Core??ó???Linux?????????Щ??
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11????????
?????????App Bug???????????????????????Jmeter?????????QC??????APP????????????????app?????е????????jenkins+testng+ant+webdriver??????????????JMeter????HTTP???????Selenium 2.0 WebDriver ??????