skdutta@cs.tamu.edu (Saumen K Dutta) (07/13/90)
Is there any way to kill a <defunct> process without rebooting the system. What has happened is something like this In a C program I invoked a background process in some node using rsh. system("rsh node1 command&"); This creates a background process and runs the command. After running the above file few times I saw that the system is loaded with many unwanted processes all of which are swapped to the disk and seems to be waiting for some DISK I/O for some unknown reason. The process table shows them to be the defunct processes. I tried to kill them in so many different ways known to me. Is there anybody who can help me to sort out the problem. I want to kill these unwanted processes without rebooting the whole system. I need the solution urgently. Please send e-mail if you have any idea Thanks -- _ ||Internet: skdutta@cssun.tamu.edu ( /_ _ / --/-/- _ ||Bitnet : skd8107@tamvenus.bitnet __)_/(_____(_/_(_/_(_(__(_/_______ ||Uucp : uunet!cssun.tamu.edu!skdutta .. ||Yellnet: (409) 846-8803
cpcahil@virtech.uucp (Conor P. Cahill) (07/13/90)
In article <6530@helios.TAMU.EDU> skdutta@cs.tamu.edu (Saumen K Dutta) writes: >Is there any way to kill a <defunct> process without rebooting the system. There is no way to get rid of a "defunct" process because the process doesn't really exist. >What has happened is something like this > >In a C program I invoked a background process in some node using rsh. > >system("rsh node1 command&"); What is probably causing the defunct here is the rsh command itself. If you run system("some command &"); the system() returns once the shell that started your command exits. Your command is then re-parented to init (since it's parent - the shell - has exited). >This creates a background process and runs the command. After running the >above file few times I saw that the system is loaded with many unwanted >processes all of which are swapped to the disk and seems to be waiting >for some DISK I/O for some unknown reason. The process table shows them >to be the defunct processes. Defunct processes do not get swapped to disk because there is no process associated with a defunct. It only takes up a slot in the process table to hold some process information (like execution times, exit status, etc) that is to be returned to its parent. >I tried to kill them in so many different ways known to me. Is there >anybody who can help me to sort out the problem. I want to kill these >unwanted processes without rebooting the whole system. I need the >solution urgently. To fix your problem you need to find out why rsh is leaving the defunct processes lying around (i.e why it isn't waiting on the processes or why it doesn't just die & go away so init can wait on them). -- Conor P. Cahill (703)430-9247 Virtual Technologies, Inc., uunet!virtech!cpcahil 46030 Manekin Plaza, Suite 160 Sterling, VA 22170
leo@ehviea.ine.philips.nl (Leo de Wit) (07/17/90)
In article <1990Jul13.133702.12546@virtech.uucp> cpcahil@virtech.UUCP (Conor P. Cahill) writes: | |To fix your problem you need to find out why rsh is leaving the |defunct processes lying around (i.e why it isn't waiting on the |processes or why it doesn't just die & go away so init can wait on |them). A good point to look at is whether the command started by rsh had its standard channels (stdin, stdout, stderr) closed; if it doesn't, that is exactly the reason the defunct process is still laying around. So close(0); close(1); close(2); (and appropriate open's) in the command started by rsh, or exec >&- exec 2>&- exec <&- if the command is a shell script. Leo.