首页 > > 详细

C辅导 zombie process讲解留学生Matlab程序

Introduction


#include
#include
#include
int main()
{
if(!fork())
{
if(fork())
{
sleep(30);
}
}
return 0;
}
Requirement
Using either a UNIX or a Linux system, write a C program that forks a child process that ultimately becomes a zombie process.
This zombie process must remain in the system for at least 10 seconds. Process states can be obtained from the command ps -l
The process states are shown below the S column; processes with a state of Z are zombies. The process identifier (pid) of the
child process is listed in the PID column, and that of the parent is listed in the PPID column. Perhaps the easiest way to
determine that the child process is indeed a zombie is to run the program that you have written in the background (using the )
and then run the command ps -l to determine whether the child is a zombie process. Because you do not want too many zombie
processes existing in the system, you will need to remove the one that you have created. The easiest way to do that is to
terminate the parent process using the kill command. For example, if the process id of the parent is 4884, you would enter
kill -9 4884Upload a video of the program running and you demonstrating the operations. Include a zip of the project as well.

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!