Oracle Interview Question
Software Engineer / Developersusually a process will be terminated when it is getting completed(normally).
but there are some more situatons inwhich the process moves to the exit state without completion
they are:
1.when the parent process of this process is terminated ,this child process will be forced to terminate irrespective of its status of execution.
2.whenever a hardware problem (like power failure, memory reset etc.) the termination of process can occur.
there are two more situations but i'm not very much clear.
Normal Termination:
1) Normal program completion
2) By calling Abort(), exit()
Abnormal Termination:
1) Any signals like SIGSEGV, SIGABORT raised
A user process can terminate another user process by generating kill system call with signal numbers like 6, 11 etc.
I believe, there are several other signals which can terminate a process too.
Ex: SIGKILL, SIGSTOP - which can not be caught.
SIGINT etc - whose default action is to stop (i.e. if not handled).
But above post covers most of the things..
There are eight ways for a process to terminate. Normal termination occurs in five ways:
1. Return from main
2. Calling exit
3. Calling _exit or _Exit
4. Return of the last thread from its start routine
5. Calling pthread_exit from the last thread
Abnormal termination occurs in three ways:
6. Calling abort
7. Receipt of a signal
8. Response of the last thread to a cancellation request
Child process does not terminate when the parent process is shut down
- DashDash July 06, 2010The child process is orphaned and a separate process called the init process becomes its parent.
Normally terminating a process: Calling return, exit
Abnormally : endprocess