Fedora : System call and fork call

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Radz
    New Member
    • Oct 2008
    • 2

    Fedora : System call and fork call

    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.
  • Laharl
    Recognized Expert Contributor
    • Sep 2007
    • 849

    #2
    We won't do your homework for you. We will, however, help you with questions you have about code you've written yourself.

    Comment

    • ashitpro
      Recognized Expert Contributor
      • Aug 2007
      • 542

      #3
      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

      Comment

      Working...