473,671 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Kill Child Process

Hi,
My query is...

I have a parent process which forks a child process to perform certain
task.
I wish to terminate the child process after certain amount of time
(say 60 secs).
Since I dont wish to leave any zombie process, I need to notify the
Child that it has to terminate now.
The parent can terminate only after all the child processes have
terminated.

How can I achieve this task.
I heard something about SIGUSR1 signal but not sure how to use it and
how it can be useful...

Can anyone guide me please?

Thanks.
Sep 9 '08 #1
4 4844
On 9 Sep, 08:28, Ashit Vora <a.k.v...@gmail .comwrote:
I have a parent process which forks a child process to perform certain
task.
I wish to terminate the child process after certain amount of time
(say 60 secs).
<snip>

you are off-topic for comp.lang.c. Please post to a platform specific
ng. For instance if you are on a Unix system try comp.unix.progr amming

--
Nick Keighley

Sep 9 '08 #2
Ashit Vora wrote:
Hi,
My query is...
...off topic again.

--
Ian Collins.
Sep 9 '08 #3
On Sep 9, 12:32*am, Ian Collins <ian-n...@hotmail.co mwrote:
Ashit Vora wrote:
Hi,
My query is...

..off topic again.

--
Ian Collins.
Sorry :(
Sep 9 '08 #4
On 9 Sep 2008 at 7:28, Ashit Vora wrote:
I have a parent process which forks a child process to perform certain
task. I wish to terminate the child process after certain amount of
time (say 60 secs). Since I dont wish to leave any zombie process, I
need to notify the Child that it has to terminate now.
Remember the child's PID when you fork(2), and send it a suitable
signal with kill(2). Then in the parent process, call wait(2) so that
the child doesn't remain in the kernel process table as a zombie.
Sep 9 '08 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
7043
by: Bob Swerdlow | last post by:
My application starts up a number of processes for various purposes using: self.popen = popen2.Popen3("/usr/local/bin/python -O "myscript.py") and then shuts them down when appropriate with os.kill(self.popen.pid, signal.SIGTERM) Everything works fine on MacOSX. However, I'm doing a port to Solaris (so I can run it on my web site) and find that the child processes are not stopping! Solaris is creating TWO new processes: one for the SHELL...
2
1538
by: Tor Erik Sønvisen | last post by:
Hi. From my Python-program I spawn a new process. When using P_NOWAIT spawnl returns the pid but in windows it returns a process handle. Later I want to kill this process. How can I do this when I only have the process handle? -tores-
3
6383
by: pattanawadee | last post by:
Deall All, Could anybody suggestion me How to kill all inherrit processes (sibling child,previous and parent process) in the case I know only child process id and user id, For example I strart to trace pid 124 of user A (uid = 100) and then I noticed that he doing something wrong so, I get process id now process id is 156 (supposed) then I want to kill all inherrit processes of user A (now I know only this process is 156 and uid is 100)...
1
3459
by: Alexander N. Spitzer | last post by:
I am trying to write a program that will fork a process, and execute the given task... the catch is that if it runs too long, I want to clean it up. this seemed pretty straight forward with a single executable being run from the fork. The problem I am having now is that if I call a shell scripts, then lets say calls "xterm &", after the timeout has occurred, I kill the shell script, but the xterm is still running... I cannot seem to kill...
0
6126
by: lynn | last post by:
I'm doing a c# asp.net web application. It create a process "A" to excute an .exe file. This exe file is compiled from c++. In this exe file it will create another new process "B" to excute another .exe file. (This one is VB, but I think this doesn't matter). What I want to do is when I kill the first process "A" from c#(usill kill() function) I want to kill the child process "B" at the same time. If all is in c++ maybe I can figure it out...
10
2990
by: I. Myself | last post by:
Suppose we spawn a child process with Popen. I'm thinking of an executable file, like a compiled C program. Suppose it is supposed to run for one minute, but it just keeps going and going. Does Python have any way to kill it? This is not hypothetical; I'm doing it now, and it's working pretty well, but I would like to be able to handle this run-on condition. I'm using Windows 2000, but I want my program to be portable to linux. ...
2
2155
by: Poly-poly man | last post by:
I am working on a GTK Midi player (timidgtk.sourceforge.net). As you can see, it's just a timidity frontend. With version 0.03, I'm trying to devel it to use SDL_sound to play the midis. First off, is there a better library for this? Right now I'm writing a test program to play on console, just so that I can narrow problems down very quickly. I have a "sound.c" (basically playsound from SDL_sound, but without a lot of features. I added...
4
20774
by: Richard Rossel | last post by:
Hi Fellows, I have a problem with process termination. I have a python code that apache runs through a django interface. The code is very simple, first, it creates a process with the subprocess.Popen call, and afterwards, (using a web request) the python code uses the PID of the previously created process(stored in a db) and kills it with an os.kill call using the SIGKILL signal. The creation of the process is ok, apache calls the...
6
16903
by: itsraghz | last post by:
Dear All, I have an issue with destroy() method of java.lang.Process class. All what I am trying to do is, controlling the execution of one program through another. Let's say, Program B has to be executed conditionally through Program A based on the commands it gets from the user. Let's say, we have two inputs, "start" and "stop" to drive the Program B. I have thought of various alternatives. (1) Using Thread to control the execution...
0
8393
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8821
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8670
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7437
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6229
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4225
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4407
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2812
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 we have to send another system
2
1809
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.