By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,269 Members | 1,507 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,269 IT Pros & Developers. It's quick & easy.

Fedora : System call and fork call

P: 2
when the fork system call is executed, a new process is created. The original process is called the parent process whereas the new process is called the child process. The new process consists of a copy of the address space of the parent. On success, both processes continue execution at the instruction after the fork call, with one difference, the return code for the fork system call is zero for the child process, while the process identifier of the child is returned to the parent process. On failure, a -1 will be returned in the parent's context, no child process will be created, and an error number will be set appropriately.

Keeping the above stated working of the fork system call, you have to write a program in C language using Linux environment. This program should produce the following results:

Display the Process ID of the Parent and Child processes using getppid() and getpid() system calls respectively.
You have to prove that on successful fork ( ) execution, the process identifier of the Child process is returned to the Parent process as stated in the above mentioned working of the fork system call.
Prove that the Process ID of the Parent process do not change after fork system call execution.
Nov 1 '08 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 849
We won't do your homework for you. We will, however, help you with questions you have about code you've written yourself.
Nov 2 '08 #2

ashitpro
Expert 100+
P: 542
Please search on google...
There are thousands of samples for fork()...
You implement with your own way and if you get any trouble, we are here......

Regards,
Ash
Nov 3 '08 #3

Post your reply

Sign in to post your reply or Sign up for a free account.