题目内容

下面的代码,只会有一个判断输出,要么是子进程,要么是父进程: #include #include #include int main(int argc, char * argv[]) { int pid; /* fork another process */ pid = fork(); if (pid < 0) { /* error occurred */ fprintf(stderr,"Fork Failed!"); exit(-1); } else if (pid == 0) { /* child process */ printf("This is Child Process!\n"); } else { /* parent process */ printf("This is Parent Process!\n"); /* parent will wait for the child to complete*/ wait(NULL); printf("Child Complete!\n"); } }

查看答案
更多问题

父进程调用fork系统调用后,fork系统调用在父进程和子进程各返回一次。

ebp总是指向堆栈的(),esp总是指向堆栈的() ______

假定当前是32位X86机器,函数的返回值默认使用哪个寄存器来返回给上级函数?比如eax、ebx、ebp、esp、eip、esi、edi等等 ______

假定当前是32位x86机器,eax寄存器的值为0x1234,ebx寄存器的值为0x4321,执行完如下代码后eax的值是多少?ebx的值是多少? movl %eax, %ebx ______

答案查题题库