为什么linux处理状态' D'可以被杀?

时间:2017-02-04 11:25:36

标签: linux process

linux进程状态' D'意思是TASK_UNINTERRUPTIBLE,所以我写一个程序员在Ubuntu 16.04上测试它

我的代码:

#include <unistd.h>
#include <iostream>
using namespace std;

int main(void) {
    pid_t  pid = vfork();
    if (pid == -1) {
        cout<<"for error"<<endl;
    } else if (pid == 0) {
        cout<<"this child is "<<getpid()<<endl;
        sleep(1000);
    } else {
        cout<<"this parent is "<<getpid()<<endl;
    }
    return 0;
}
运行程序员后,父进程的状态为“D&#39;

当我使用kill命令杀死父进程时,父进程被成功杀死,所以我的代码中有什么问题?

非常感谢!!!

0 个答案:

没有答案
相关问题