answersLogoWhite

0


Best Answer

#include<stdio.h>

#include<signal.h>

main()

{

int id;

printf("before fork()\n");

id=fork();

if(id==0)

{

printf("child has started %d \n",getpid());

printf("parent of this child %d \n",getppid());

}

else

{

printf("parent has started :%d\n ",getpid());

kill(getpid(),SIGKILL);

}

printf("after fork()\n");

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: C code for orphan process
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How can you find orphan process on Solaris?

If processes run on nodes that have derailed so to speak or the tm.watched yk has been activated, the process is considered orphaned. The watch deamons are set to kill the orphan process on default.


What is the parent process ID of an orphan process in UNIX?

Usually any orphaned process is owned by the 'init' process (process #1)


What is Zombie Process and Orphan Process?

Zombie : Child Process Exits before Parent process and Parent does not grab status of child process using wait() or waitpid() system call; Child process is in Zombie state. Orphan : Child process whose parent has been killed and inherited by init process.


How to make a code by using a lending process in a TURBO C?

#include&lt;stdio.h&gt; main(){


How do you position your variable declarations and process statements?

Formally, in C, variable declarations occur first in the block, followed by process statements. In C++, this was relaxed and declarations are permitted within the process statements. This allows somewhat easier code readability, since the declaration is near the use, but the style is yours to choose. Most modern C compilers are also C++ compilers, so the C++ rules often work in C code, though you can set flags to enforce a certain standard, if you wish.


A c plus plus code name sumcpp saved on a diskis it process or job?

It is neither. It is a source file.


Is C plus plus preprocessor software?

Sometimes, it is. Some implementations compile C++ code into C code, and then compile the C code.


What is the proper English word for the Bengali word champak?

Orphan Orphan Orphan Orphan


What is the VHDL code to implement NAND gate in behavioral model?

Below code can implement NAND gate in VHDL. The code is written in behavioral model. Library ieee; use ieee.std_logic_1164.all; Entity gates is port (a,b : in std_logic; c : out std_logic); end gates ; architecture and1 of gates is begin process(a,b) Begin If (a=1 and b=1) then C&lt;='0'; Else C&lt;= '1'; End if; End process; End and1;


What actors and actresses appeared in Haley - 2011?

The cast of Haley - 2011 includes: Bethany Blanke as Haley Herbert Blue as Orphan X Evan Bobrick as Orphan Gang Member Lauren Dusek as Dc Jon Dykstra as Orphan Gang Member Nick Flor as Orphan Gang Member Stephanie Galliart as Villager Eric Geusz as Orphan Gang Member Kaila Grafeman as Susan Marshal Grindell as Orphan Gang Member Henry Hawk as Orphan Gang Member Tom House as Orphan Gang Member Gabriele Jamae as Villager Avalon Jay as Orphan Gang Member James Lawrence Sicard as Aden Lori Nason as Villager John Ollason as Orphan Truck Driver 1 John Phan as Orphan Gang Member Corey Ponic as Orphan Gang Member Sydnie Ponic as Villager Eileen Ponic as Villager Magdalena Quintana as Orphan Gang Member Justin Ramsey as Kamas David Reza as Orphan Gang Member Jarrod Rhoades as Orphan C Ian Riela as Orphan Truck Driver 2 Nick Salyer as Villager Nathan Sanchez as Orphan Gang Member Aaron Sena as Orphan Gang Member Mike Stefani as Orphan Gang Member Natanni Tome as Orphan Gang Member


Can we use same compiler for both c and c plus plus language?

Yes. In fact both the C++ compiler and the linker are intrinsically command-driven; the IDE (if you have one) simply provides a graphical front-end to both. Consult your compiler/linker documentation to view the required command line syntax. In particular, consult the 'makefile' topic which should show you how to create a command file (or batch file) that can automate the entire process for a particular project.


Is Jim Burden an orphan?

an orphan