进程的消亡及释放资源

This commit is contained in:
lzy
2024-05-14 07:39:34 +08:00
parent e1c6873368
commit 7d08b75eaa
10 changed files with 540 additions and 1 deletions

View File

@@ -0,0 +1,41 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main(int argc, char **argv)
{
while (1)
{
prompt();
getline();
parse();
if ()
{
;
}
else // 外部命令
{
fork();
if (< 0)
{
;
}
if (0 ==) // child
{
execXX;
perror();
exit(1);
}
else // parent
{
wait();
}
}
}
exit(0);
}