11-19-2008
That paragraph isn't written very clearly. If a process created a process, the old process is that new process' parent, it's that simple.
10 More Discussions You Might Find Interesting
1. Programming
When executing this simple program:
#include <unistd.h>
void main()
{
int f;
printf("\n Parent procces ID=%d\n",getpid());
f=fork();
if(f==0)
{
printf("\n Child process ID=%d father=%d\n",getpid(),getppid());
}
... (2 Replies)
Discussion started by: bb666
2 Replies
2. Programming
Hi,
I have written a code which will run a set of process using
fork.
I want to know from You how can i start another job when one of my job in my loop is completed
My code is
#include<stdio.h>
#include<ctype.h>
main() {
int pid,cid;
ChildProcess();
... (1 Reply)
Discussion started by: sureshraju_ma
1 Replies
3. UNIX for Advanced & Expert Users
hi everybody,
what mission critical workloads and applications functions can run on the UNIX operating system?
best regards (5 Replies)
Discussion started by: styfo
5 Replies
4. Programming
Hello experts,
I am using fork() in my code but I am confused which output comes first child or parent?
I did the following code .My book shows parent first but my linux shows child first.Can anyone tell me why?
#include <stdio.h>
int main(){
int pid;
printf("I am original process with pid... (5 Replies)
Discussion started by: mlhazan
5 Replies
5. High Performance Computing
I read that 'Any single program that can run as multiple processes can benefit from OpenMosix: "The GIMP" photo editor and the "kandel" fractal generator are known to do this.
Are there other load-balancing clusters that do support multi-process applications? (1 Reply)
Discussion started by: Advice Pro
1 Replies
6. Programming
Hi everyone:
I'm developing a dynamic library for notifications, this library is used for a daemon that i've programmed, when something goes wrong the library should send an email to an administrator, but since sending an email is a non-vital process then it can fail (it should work as an... (4 Replies)
Discussion started by: edgarvm
4 Replies
7. Programming
I writing a program that forks three times but only on the parent process. The three children processes then produces output in order. 1, 2, 3. I am confused on how to do this. I have tried multiple if and else if statements but the output does not come out right. How should I go about doing this? (1 Reply)
Discussion started by: TWhitt24
1 Replies
8. Programming
Hello everybody.I want to make clear that i am not going to ask from anybody to build my asignement but i have a big problem. I can't seem to find anywhere ONE good example on C about what i am trying to do:wall:.I think it is simple. All i ask is one example, even a link is fine.
So, i want to... (1 Reply)
Discussion started by: Cuervo
1 Replies
9. Programming
i'm experimenting fork function and i found this code
#include <stdio.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <wait.h>
#include <fcntl.h>
#include <unistd.h>
int main(void)
{
int fd;
pid_t p;
p = fork();
fork();
if (p>0) { fork();}
fork();
fork();... (6 Replies)
Discussion started by: blob84
6 Replies
10. Programming
Hi All,
I have a program for class that needs to do the following:
1. Print the directory entries from the current directory using ncurses
2. Provide a prompt next to each directory entry and allow the user to enter commands that may or may not be about the file
3. Execute those commands in... (1 Reply)
Discussion started by: afulldevnull
1 Replies
getpid(2) System Calls Manual getpid(2)
NAME
getpid, getpgrp, getppid - Gets the process ID, process group ID, parent process ID
SYNOPSIS
#include <unistd.h>
pid_t getpid( void );
pid_t getpgrp( void );
pid_t getppid( void );
Application developers may want to specify an #include statement for <sys/types.h> before the one for <unistd.h> if programs are being
developed for multiple platforms. The additional #include statement is not required on Tru64 UNIX systems or by ISO or X/Open standards,
but may be required on other vendors' systems that conform to these standards.
STANDARDS
Interfaces documented on this reference page conform to industry standards as follows:
getpid(), getpgrp(), getppid(): POSIX.1, XPG4, XPG4-UNIX
Refer to the standards(5) reference page for more information about industry standards and associated tags.
DESCRIPTION
The getpid() function returns the process ID of the calling process.
The getpgrp() function returns the process group ID of the calling process.
The getppid() function returns the parent process ID of the calling process. When a process is created, its parent process ID is the
process ID of its parent process. If a parent process exits, the parent process IDs of its child processes are changed to the process ID
of the init program.
RELATED INFORMATION
System calls: fork(2), kill(2), setpgid(2), setsid(2), wait(2)
Standards: standards(5) delim off
getpid(2)