473,471 Members | 2,008 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

How to solve Zombie and Orphan Process Problems ?

4 New Member
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 6199
ashitpro
542 Recognized Expert Contributor
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
alikhan707
4 New Member
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.