2019年7月4日

上下文的概念

摘要: Linux系统的运行,有3种情况: 1、进程上下文:进程由用户态切换到内核态 2、中断上下文:内核处理中断 3、用户态程序运行 1.进程上下文: (1)进程上文:其是指进程由用户态切换到内核态是需要保存用户态时cpu寄存器中的值,进程状态以及堆栈上的内容,即保存当前进程的进程上下文,以便再次执行该进 阅读全文

posted @ 2019-07-04 10:25 chenchenxinxin 阅读(388) 评论(0) 推荐(0)

2019年6月27日

CPU消耗程序

摘要: #include <stdio.h>#include <stdlib.h>#include <sys/types.h>#include <unistd.h>#include <wait.h>/***@Usage: ./$0 [SUBPROCESS NUMBER]*/int main(int argc 阅读全文

posted @ 2019-06-27 15:29 chenchenxinxin 阅读(543) 评论(0) 推荐(0)

2019年6月19日

实时进程CPU利用率限制

摘要: 通过设置/proc/sys/kernel/sched_rt_runtime_us 和/proc/sys/kernel/sched_rt_period_us配合实现;sched_rt_period_us默认值是1s(1000000us),sched_rt_runtime_us默认是0.95s(9500 阅读全文

posted @ 2019-06-19 11:14 chenchenxinxin 阅读(1245) 评论(0) 推荐(0)

2019年6月9日

利用cgroup限制cpu和memory利用率

摘要: 我们环境使用的Linux内核版本是4.4,已支持cgroup,只要在内核配置中选上cgroup,并勾选自己想要的配置(general setup->control group support->) 网上有各种资料介绍cgroup,这里我就不详述了,直接mount cgoup mkdir cgroup 阅读全文

posted @ 2019-06-09 11:17 chenchenxinxin 阅读(3923) 评论(0) 推荐(0)

导航