1、使用ps查看当前系统中的所有进程,包括有终端和无终端的进程
![](https://i-blog.csdnimg.cn/blog_migrate/fbbcdc638b776519f7d11356ffc51ada.webp?x-image-process=image/format,png)
2、使用top命令查看当前系统中进程的cpu占有率,内存以及交换文件的使用率,观察系统负载。
![](https://i-blog.csdnimg.cn/blog_migrate/726837b3331fcfd138e2a74e61abb2e0.webp?x-image-process=image/format,png)
3、打开3个shell连接,找到这三个shell的pid
![](https://i-blog.csdnimg.cn/blog_migrate/a3c096ef6d41675bff539135cdccaed9.webp?x-image-process=image/format,png)
4、在上一步的3个shell中同事运行top,随后终止掉其中任意1个top的进程。
![](https://i-blog.csdnimg.cn/blog_migrate/bede4e04476ba4e37be659ecc31c5597.webp?x-image-process=image/format,png)
5、终止所有top的进程。
![](https://i-blog.csdnimg.cn/blog_migrate/87cca409f408c136cb745ab45344b099.webp?x-image-process=image/format,png)
选做:
2、运行yum install gcc-c++-y
![](https://i-blog.csdnimg.cn/blog_migrate/9df84c8fc3b2b61e7f738aa9f404d1e1.webp?x-image-process=image/format,png)
3、使用vi编辑一个test.cpp文件 内容如下
#include
using namespace std:
int main(){
for(int i=0;;i++)
cout<
return 0;
}
4、执行g++ test.cpp -otest
5、执行./test
6、多开几个shell分别执行 ./test 并打开一个shell运行top,观察系统负载和测试图形界面的卡顿情况。
桌面卡帧
![](https://i-blog.csdnimg.cn/blog_migrate/bb05b7bd467d94fbcf00be5ad39cb127.webp?x-image-process=image/format,png)
7、尝试使用renice命令分别设置已经打开test程序的优先级为19,并观察桌面是否依然卡顿。
设置完 ./test程序的优先级后桌面不再卡帧
![](https://i-blog.csdnimg.cn/blog_migrate/4539b66a75f43df3c1cec24661e7d627.webp?x-image-process=image/format,png)