in Operating System
691 views
1 vote
1 vote

what is the output of the following program?

int ret = fork();
if(ret == 0) {
    exec(some_binary); // this call fails
    printf("child ");
}else {
    wait();
    printf("parent\n");
}

 

  1. Runtime Error
  2. child

  3. parent

  4. child parent

in Operating System
by
691 views

1 comment

$4$ ?
0
0

1 Answer

1 vote
1 vote

Runtime Error

wait() system call needs an argument "status" so its syntax should be like wait(&status).

 

 

Related questions

3 votes
3 votes
1 answer
4