473,385 Members | 2,044 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

How to solve Zombie and Orphan Process Problems ?

Hey guys i need help on this problem ..
How to solve zombie and orphan process problems ?
Please explain with an example...
Mar 23 '08 #1
2 6194
ashitpro
542 Expert 512MB
Hey guys i need help on this problem ..
How to solve zombie and orphan process problems ?
Please explain with an example...

when you fork a new process, it's parents responsibility to query the exit status of the child. This exit status can be queried by system calls like 'wait','waitpid' etc
Expand|Select|Wrap|Line Numbers
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <sys/wait.h>
  4. main()
  5. {
  6.   int i, j, status;
  7.   i = fork();
  8.   if (i > 0) //parent 
  9.   {
  10.     j = wait(&status);
  11.   } 
  12.   else //child
  13.   {
  14.        sleep(1000);
  15.         exit(0);
  16.   }
  17. }
  18.  
In this code parent will wait till child finishes.
So in short..parent must issue a wait call to avoid a zombie processes.
Mar 23 '08 #2
Thanks it works ............
Mar 24 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Brian | last post by:
From one script, I'm spawnv'ing another that will launch mpg123 to play a specified mp3. Problem is that After the second script has launched mpg123, it'll turn into a zombie process. It doesn't...
4
by: A. Tillman | last post by:
We are having a really big problem with a zombie process/transaction that is blocking other processes. When looking at Lock/ProcessID under Current Activity I see a bunch of processes that are...
0
by: net guest via DotNetMonster.com | last post by:
Hi, i am facing a lot of problems in killing the orphan excel instances. I approached one method like killing the Excel Orphan with processID. I am getting all the Processess that are running...
0
by: Turtle | last post by:
I'm running devenv.exe from a batch file, with a /runexit command line switch. The devenv opens fine, runs and exits. All looks great, except that the next line in the batch file doesn't execute...
1
by: Gunnar | last post by:
Are there any way of detecting that a program have crashed and left an orphan file? I have tried with the filesystemwatcher, but that didn't work. Maybe I can use a polling strategy and keep...
1
by: julian_m | last post by:
I'm working with mysql without referential itegrity. Let me make some small example: tableA +-----------+---------------+ | id_1 | data_1 | +-----------+---------------+ | 1 ...
2
by: julian_m | last post by:
I'm working with mysql without referential itegrity. Let me make some small example: tableA +-----------+---------------+ | id_1 | data_1 | +-----------+---------------+ | 1 ...
0
by: nisimura | last post by:
Hi, I noticed that when I used SocketServer.ForkingMixIn (ForkingTCPServer), there were always zombie processes around. I searched for where waitpid() is called in ForkingMixIn and found it in...
2
by: anilchowdhury | last post by:
main() { pid_t child; child=fork(); if(child > 0) {sleep(60); }
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.