6.3k views
2 votes
when does a successful call for exec() return to the calling program? group of answer choices when the program loaded by exec() terminates without problems. never when zombi processes come back to life (i.e., are scheduled to run again). when the os preempts the calling process before the new code is executed.

User JeremyWeir
by
4.5k points

1 Answer

3 votes

Answer:

A successful call to exec() will return to the calling program only when the program loaded by exec() terminates without problems. exec() is a function in the C standard library that is used to execute a new program. When exec() is called, it replaces the current process with the new program, and the new program is executed in the place of the original process. If the new program terminates successfully, control is returned to the calling program. However, if the new program encounters an error or is terminated by the operating system, control will not be returned to the calling program.

Option 2, "never," is incorrect because a successful call to exec() will return to the calling program when the new program terminates successfully.

Option 3, "when the os preempts the calling process before the new code is executed," is also incorrect because exec() does not return control to the calling program until the new program terminates.

Option 1, "when the program loaded by exec() terminates without problems," is correct because this is the only situation in which exec() will return control to the calling program.

User Mikael Rousson
by
4.6k points