Sponsored Content
Top Forums Programming zombie to exist after the termination of main program.. Post 302169785 by anilchowdhury on Friday 22nd of February 2008 01:52:52 PM
Old 02-22-2008
zombie to exist after the termination of main program..

main()
{
pid_t child;
child=fork();

if(child > 0)

{sleep(60);
}

else
{exit(0);
}

}

the above code will create zombie process,which will be adopted by init as soon as parent process will dies.Can any one gimme a code or an alogrithm to keep this zombie proocess alive even after its parent dies...i.e to stop init from adopting it after the termination of main programme
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Abnormal Termination errors

I'm having trouble with Abnormal Termination errors. What are they, what causes them and how can I prevent them from happening? Are they application specific? (2 Replies)
Discussion started by: bialsibub
2 Replies

2. UNIX for Dummies Questions & Answers

zombie program

When you run a ps -ef and if the status is a Z (zombie) does that mean the same as not responding? (Like a windows machine). Also has anyone here heard of the program called 'top' (I've found it on our Solaris 7 machines) If you have you might be able to help me. I need to know if there is a... (8 Replies)
Discussion started by: merlin
8 Replies

3. Shell Programming and Scripting

zombie processes and hung process termination

Is there a way I can run a command that will run in the kernel or in the memory and automatically kill certain scripts if they get to <defunct> processes, without having to be monitoring the server manually? I have a Perl script which runs for 20k members and normally does not have any problems,... (2 Replies)
Discussion started by: ukndoit
2 Replies

4. Red Hat

Zombie Process Termination Time

Hey, I've got a program that fork's a list of child processes, and keeps their pid's in a list. After the parent finishes it's main business logic, it needs to check which child already finished - and when. Is it possible - using waitpid or any other func\syscall - get this information... (0 Replies)
Discussion started by: sternr
0 Replies

5. Shell Programming and Scripting

Problem with ssh termination...

hi all, i have a situation where i run ssh command from a unix machine to execute few scripts on 2 other unix machines. my problem is, the scripts that i run will start few commands on the 2 servers and will quit....i am able to quit from the script but i have to give ctrl+c (on the... (10 Replies)
Discussion started by: niteesh_!7
10 Replies

6. Shell Programming and Scripting

To see if a program exist and is executable

Hi, I am making a program that needs to detect if the program name in parameter is a valid runable program. But the line if ; then never seem to work. Even if I run like: ./script cat "-u" cat "-u" inputfile Thank you everyone. #!/bin/bash # usage() { #print usage message and quit... (4 Replies)
Discussion started by: leonmerc
4 Replies

7. Shell Programming and Scripting

main program is not calling small other programs

I am trying to understand a program in a book and this program suppose to call other programs which are in the same folder, the other programs are called 'lu' and 'add' but for some reason when it gets to the last line of each case to call these programs there is an error message saying ./rolo:... (2 Replies)
Discussion started by: bartsimpsong
2 Replies

8. AIX

Help with AIX XL C++ complier: app exit before main program

I have two shared libraries, A, B(B depents on A, both linked with -G option which means they're rtl enable), B's toc size is bigger than 64K(-bbigtoc), while A's toc size smaller than 64K. Then I write a "Hello, world" example E, and link with A and B. Link cmd 1: xlC128_r -o E E.o -lA -lB... (0 Replies)
Discussion started by: jackliang
0 Replies

9. AIX

Calling functions from main program from dlopened library function

Hello All, I am trying to call a function from the calling main program from a dlopened library function, below is the entire code, when I execute it it crashes with sigill. Can you guys help me out I guess I am missing out on the linker flag or something here. besides I am new to AIX and... (1 Reply)
Discussion started by: syedtoah
1 Replies

10. UNIX for Advanced & Expert Users

Could not find the main class: Grasp. Program will exit.

I am having trouble running jgrasp. I get the message above when I try to run jgrasp. I am running fedora if that makes a difference. I have already set my environmental variable with this. Hopefully I did it right. JGRASP_HOME=/opt/jgrasp export... (0 Replies)
Discussion started by: cokedude
0 Replies
preap(1)							   User Commands							  preap(1)

NAME
preap - force a defunct process to be reaped by its parent SYNOPSIS
preap [-F] pid... DESCRIPTION
A defunct (or zombie) process is one whose exit status has yet to be reaped by its parent. The exit status is reaped via the wait(3C), waitid(2), or waitpid(3C) system call. In the normal course of system operation, zombies may occur, but are typically short-lived. This may happen if a parent exits without having reaped the exit status of some or all of its children. In that case, those children are reparented to PID 1. See init(1M), which periodically reaps such processes. An irresponsible parent process may not exit for a very long time and thus leave zombies on the system. Since the operating system destroys nearly all components of a process before it becomes defunct, such defunct processes do not normally impact system operation. However, they do consume a small amount of system memory. preap forces the parent of the process specified by pid to waitid(3C) for pid, if pid represents a defunct process. preap will attempt to prevent the administrator from unwisely reaping a child process which might soon be reaped by the parent, if: o The process is a child of init(1M). o The parent process is stopped and might wait on the child when it is again allowed to run. o The process has been defunct for less than one minute. OPTIONS
The following option is supported: -F Forces the parent to reap the child, overriding safety checks. OPERANDS
The following operand is supported: pid Process ID list. EXIT STATUS
The following exit values are returned by preap, which prints the exit status of each target process reaped: 0 Successfully operation. non-zero Failure, such as no such process, permission denied, or invalid option. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWesu (32-bit) | +-----------------------------+-----------------------------+ | |SUNWesxu (64-bit) | +-----------------------------+-----------------------------+ SEE ALSO
proc(1), init(1M), waitid(2), wait(3C), waitpid(3C), proc(4), attributes(5) WARNINGS
preap should be applied sparingly and only in situations in which the administrator or developer has confirmed that defunct processes will not be reaped by the parent process. Otherwise, applying preap may damage the parent process in unpredictable ways. SunOS 5.10 26 Mar 2001 preap(1)
All times are GMT -4. The time now is 03:33 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy