代码:
#include<stdio.h>
#include<time.h>
#include <unistd.h>
int main()
{
while(1)
{
printf("xxxx\n");
sleep(3);
}
return 0;
}
编译一下,然后运行./hello &
然后关闭xshell, 再次启动xshell , ps -fe|grep hello
发现该进程是在存在的。
顺便请教一个top命令:
top - 19:06:38 up 1:07, 1 user, load average: 0.00, 0.00, 0.00
Tasks: 141 total,
1 running, 140 sleeping, 0 stopped, 0 zombie
为什么好几次, 执行该top命令,发现
只有一个1 runing,为什么?
百度过很多次,发现top的讲解,铺天盖地的讲解,running是表示 运行的进程数目。
我去,难道我 的机器上只有一个进程在running,其他都被挂起?
linux 这么神奇?