Process Termination or destroy a process Processes may request their own termination by making the exit( ) system call, typically returning an int. This int is passed along to the parent if it is doing a wait( ) , and is typically zero on successful completion and some non-zero code in the event of problems. child code: int exitCode; exit( exitCode ); // return exitCode; has the same effect when executed from main( ) parent code: pid_t pid; int status pid = wait( &status ); // pid indicates which child exited. exitCode in low-order bits of status // macros can test the high-order bits of status for why it stopped Processes may also be terminated by the system for a variety of reasons, including: The inability of the system to deliver necessary system resources. In response to a KILL command, or other un handled process interrupt. A parent may kill its children if the task a...
Comments
Post a Comment