Difference of Fork between Linux and Unix

Discussion in 'General Linux' started by jaeHyukLee, Jul 5, 2013.

  1. jaeHyukLee

    jaeHyukLee New Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    I learned that Fork in Unix return to parent First and later return to child, but it makes useless copy in COW(Copy On Write) because usually Child process are different from parent.

    So.. to get rid of useless copy in Unix's Fork system call, Linux's Fork pushes Child process in Ready Queue with higher priority than Parent and Let OS check Ready List to give CPU to another process if it has much higher priority than current process When it return from Kernel.

    Then in Linux do need wait system call in Parent process Routine? like below
    //Code Start
    pid = fork();
    if (pid == 0) /* This is child process */
    {
    printf("I am Child \n");
    execlp("/bin/date", "/bin/date", (char *) 0);
    }
    else /* This is parent process */;
    wait();/*parent sleeps child run to completion parent resume*
    /* If wait(2) is omitted, parent runs concurrently with child */
    //Code End

    Can i delete wait System call in Linux? because we don't make Parent wait until child end, because Child process is executed before Parent is restarted.


    and second Question.
    How Parent process know Child Process end or not in Linux?
    In Unix system, Parent waits Child process to be End and wait system call makes it available. In other words, OS make parent sleep in wait list until child to be finished, but in Unix if we use Wait System call in Parent service routine, we can't execute wait call before Child process end. Then how can we make Parent know Child process End?
  2. ryanvade

    ryanvade Administrator Staff Member Staff Writer

    Messages:
    889
    Likes Received:
    288
    Trophy Points:
    63
    [​IMG]
  3. jaeHyukLee

    jaeHyukLee New Member

    Messages:
    4
    Likes Received:
    0
    Trophy Points:
    1
    You always replied my questions Thanks for your help.
    By the way could you recommend some book for learning Linux platform?
    Nowadays, i read linux_kernel_development_3rd_edition(robert love)
    I thinks it's good book, but i need more books to read
    Please recommend some book to me
    Thanks for your help :)
  4. ryanvade

    ryanvade Administrator Staff Member Staff Writer

    Messages:
    889
    Likes Received:
    288
    Trophy Points:
    63
    Your welcome. Helping people with Linux is my thing...

    Sorry, I can't really recommend anything. All of my books are old too. ;)
    I guess you could look at linuxfoundation.org They might have something. I know that linuxfoundation paid members get discounts on O'Reilly books. They have good Linux technical books. There is a section on Amazon dedicated to Linux:
    http://www.amazon.com/Linux-Operating-Systems-Books/b?ie=UTF8&node=3849

Share This Page