Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Question about a process lifecycle Post 303044261 by Chubler_XL on Monday 17th of February 2020 03:09:10 PM
Old 02-17-2020
A process calls the wait() function and kernel level code checks the status of a child process, it will suspend execution of the calling thread until status information for one of the terminated child processes is is available.

A call to the exit() function causes a normal termination of the process that calls exit(). There is no involvement with the parent process, in fact the parent process may have already terminated at this stage.

Note that a running process can also be terminated by sending it a signal (like SIGTERM or SIGKILL).
This User Gave Thanks to Chubler_XL For This Post:
 

8 More Discussions You Might Find Interesting

1. Programming

parent and child process question?

Hi everybody, I'm trying to understand how a parent and child processes interact. This function( below) basically measures the fork time from the perspective of the parent only. what i would like to know is how to measure the time from the perspective of parent and child (ie: inserting... (0 Replies)
Discussion started by: tosa
0 Replies

2. UNIX for Dummies Questions & Answers

Silly question about a process

I know its kinda silly but I've seen the texts consider one side - a thread executes and finishes its task but I was wondering what will happen if the process dies when the thread is still under execution... I somehow think that the thread will continue execution but am backing off from the fact... (10 Replies)
Discussion started by: Legend986
10 Replies

3. Virtualization and Cloud Computing

Adaptive Information Technology for Service Lifecycle Management

HPL-2008-80 Adaptive Information Technology for Service Lifecycle Management - Rolia, Jerry; Belrose, Guillaume; Brand, Klaus; Edwards, Nigel; Gmach, Daniel; Graupner, Sven; Kirschnick, Johannes; Stephenson, Bryan; Vickers, Paul; Wilcock, Lawrence Keyword(s): Software as a Service, Enterprise... (0 Replies)
Discussion started by: Linux Bot
0 Replies

4. UNIX for Dummies Questions & Answers

Zombie process question

Hey guys, So i did some research on the site but previous posts answered most of my questions about zombie processes but I have one question that didnt seem to get addressed "how do you find the parent or parent ID of a zombie process so you can kill it?" I know p -kill doesnt always just... (6 Replies)
Discussion started by: kingpin007
6 Replies

5. AIX

AIOServer process question

Hi I've been trying to learn a bit more about AIOServer processes and how my company administers them, one question i have is, while checking, most of my servers show a memory overhead of about 448 k per aioserver process (nmon -A) however i have found a few with figures of 67 or 56k. Most... (0 Replies)
Discussion started by: philib
0 Replies

6. UNIX for Dummies Questions & Answers

Process Substitution Question?

Hello to all. I'm new to this forum, so please go easy on me. =) I am working on a script to send two e-mail attachments in a single e-mail, and am running into a little bit of an issue when using process substitution. I am using the following: cat <(uuencode $1 <(basename $1)) <(uuencode... (5 Replies)
Discussion started by: rommager
5 Replies

7. Homework & Coursework Questions

C++ Environment needed on Solaris,Program lifecycle

Hello, I would like to build some sample C++ application on Solaris SunOS 5.8 Generic Virtual sun4v sparc. so I would like to know what are the compilation utilities and runtime utilities I need to get in my machine and will any one explain me the detaied life cycle of program like what... (1 Reply)
Discussion started by: Revathi R
1 Replies

8. Solaris

Lifecycle patching

I am trying to understand how people manage lifecycle patching these days. I am not a sysadmin (I am a DB Architect) and what I am being told is that if there is any lag between patching a dev server and a prod server that we will liley get new patches in prod that have not had any soak time in... (9 Replies)
Discussion started by: mse
9 Replies
WAIT(2) 							System Calls Manual							   WAIT(2)

NAME
wait, waitpid, wait4, wait3 - wait for process terminatation SYNOPSIS
#include <sys/types.h> #include <sys/wait.h> pid = wait(status) int pid; union wait *status; #include <sys/time.h> #include <sys/resource.h> pid = waitpid(wpid, status, options); int pid; int wpid; union wait *status; int options; pid = wait3(status, options, rusage); int pid; union wait *status; int options; struct rusage *rusage; pid = wait4(wpid, status, options, rusage); int pid; int wpid; union wait *status; int options; struct rusage *rusage; DESCRIPTION
The wait function suspends execution of its calling process until status information is available for a terminated child process, or a sig- nal is received. On return from a successful wait call, the status area contains termination information about the process that exited as defined below. The wait4 call provides a more general interface for programs that need to wait for certain child processes, that need resource utilization statistics accummulated by child processes, or that require options. The other wait functions are implemented using wait4 . The wpid parameter specifies the set of child processes for which to wait. If wpid is -1, the call waits for any child process. If wpid is 0, the call waits for any child process in the process group of the caller. If wpid is greater than zero, the call waits for the process with process id wpid . If wpid is less than -1, the call waits for any process whose process group id equals the absolute value of wpid . The status parameter is defined below. The options parameter contains the bitwise OR of any of the following options. The WNOHANG option is used to indicate that the call should not block if there are no processes that wish to report status. If the WUNTRACED option is set, children of the current process that are stopped due to a SIGTTIN , SIGTTOU , SIGTSTP , or SIGSTOP signal also have their status reported. If rusage is non-zero, a summary of the resources used by the terminated process and all its children is returned (this information is cur- rently not available for stopped processes). When the WNOHANG option is specified and no processes wish to report status, wait4 returns a process id of 0. The waitpid call is identical to wait4 with an rusage value of zero. The older wait3 call is the same as wait4 with a wpid value of -1. The following macros may be used to test the manner of exit of the process. One of the first three macros will evaluate to a non-zero (true) value: WIFEXITED(status) - True if the process terminated normally by a call to _exit(2) or exit(2) . WIFSIGNALED(status) - True if the process terminated due to receipt of a signal. WIFSTOPPED(status) - True if the process has not terminated, but has stopped and can be restarted. This macro can be true only if the wait call specified the WUNTRACED option or if the child process is being traced (see ptrace(2)). Depending on the values of those macros, the following macros produce the remaining status information about the child process: WEXITSTATUS(status) - If WIFEXITED(status) is true, evaluates to the low-order 8 bits of the argument passed to _exit(2) or exit(2) by the child. WTERMSIG(status) - If WIFSIGNALED(status) is true, evaluates to the number of the signal that caused the termination of the process. WCOREDUMP(status) If WIFSIGNALED(status) is true, evaluates as true if the termination of the process was accompanied by the creation of a core file containing an image of the process when the signal was received. WSTOPSIG(status) If WIFSTOPPED(status) is true, evaluates to the number of the signal that caused the process to stop. NOTES
See sigvec(2) for a list of termination signals. A status of 0 indicates normal termination. If a parent process terminates without waiting for all of its child processes to terminate, the remaining child processes are assigned the parent process 1 ID (the init process ID). If a signal is caught while any of the wait calls is pending, the call may be interrupted or restarted when the signal-catching routine returns, depending on the options in effect for the signal; see intro(2), System call restart. RETURN VALUES
If wait() returns due to a stopped or terminated child process, the process ID of the child is returned to the calling process. Otherwise, a value of -1 is returned and errno is set to indicate the error. If wait4(), wait3() or waitpid() returns due to a stopped or terminated child process, the process ID of the child is returned to the call- ing process. If there are no children not previously awaited, -1 is returned with errno set to [ECHILD]. Otherwise, if WNOHANG is speci- fied and there are no stopped or exited children, 0 is returned. If an error is detected or a caught signal aborts the call, a value of -1 is returned and errno is set to indicate the error. ERRORS
Wait() will fail and return immediately if: [ECHILD] The calling process has no existing unwaited-for child processes. [EFAULT] The status or rusage arguments point to an illegal address. (May not be detected before exit of a child process.) [EINTR] The call was interrupted by a caught signal, or the signal had the SV_INTERRUPT flag set. STANDARDS
The wait and waitpid functions are defined by POSIX; wait4 and wait3 are not specified by POSIX. The WCOREDUMP macro and the ability to restart a pending wait call are extensions to the POSIX interface. SEE ALSO
exit(2) , sigvec(2) A wait function call appeared in Version 6 AT&T UNIX. 4th Berkeley Distribution March 12, 1993 WAIT(2)
All times are GMT -4. The time now is 09:12 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy