#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    2
    Rep Power
    0

    How can I run a child process without fork()?


    Hi! I'm new to this forum, so hopefully I won't violate local etiquette. I did not find an answer to this question here yet, so I'm posting my own thread.

    From one running parent process, I need to launch a new process (a separate executable, in its own memory space, which the parent will then wait for), but I DO NOT need or want to clone the memory space of the parent. I am new to fork/exec/wait also, but so far my research has indicated that fork() will not exactly accomplish this. Ultimately I must find a way to do this for both Win32 & Unix-like platforms, but an answer for one will be a great start.

    Thanks in advance for you time!

    -Matthew-
    Last edited by Ferrando; September 26th, 2003 at 09:51 AM.
  2. #2
  3. I'm Baaaaaaack!
    Devshed God 1st Plane (5500 - 5999 posts)

    Join Date
    Jul 2003
    Location
    Maryland
    Posts
    5,538
    Rep Power
    244
    ALL forking results in a copy of the parent's memory. Don't worry about it, it is an OS thing and won't affect your performance (most of the code pages will not actually be copied if you have a copy on write OS/hardware setup as most are nowadays).

    My blog, The Fount of Useless Information http://sol-biotech.com/wordpress/
    Free code: http://sol-biotech.com/code/.
    Secure Programming: http://sol-biotech.com/code/SecProgFAQ.html.
    Performance Programming: http://sol-biotech.com/code/PerformanceProgramming.html.
    LinkedIn Profile: http://www.linkedin.com/in/keithoxenrider

    It is not that old programmers are any smarter or code better, it is just that they have made the same stupid mistake so many times that it is second nature to fix it.
    --Me, I just made it up

    The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore, all progress depends on the unreasonable man.
    --George Bernard Shaw
  4. #3
  5. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2003
    Posts
    2
    Rep Power
    0

    Thanks!


    I appreciate the advice. Don't really know why I was worried about it anyway. Everything is running just fine. Thanks again!

IMN logo majestic logo threadwatch logo seochat tools logo