fork a child or create a thread?

This is a discussion on fork a child or create a thread? within the C Programming forums, part of the General Programming Boards category; hi all: these days I'm learning to use multiprocess and multithread. I've a question that when a child process is ...

  1. #1
    Registered User
    Join Date
    Jun 2008
    Posts
    4

    fork a child or create a thread?

    hi all:
    these days I'm learning to use multiprocess and multithread. I've a question that when a child process is better than create threads. And under what condition in your code, you'll use multithread other than multiprocess?
    thank !

  2. #2
    Deathray Engineer MacGyver's Avatar
    Join Date
    Mar 2007
    Posts
    3,211
    For small tasks, and tasks where you must share memory and such, threads are probably best.

  3. #3
    Ugly C Lover audinue's Avatar
    Join Date
    Jun 2008
    Location
    Indonesia
    Posts
    489
    Threads are better because they consume a little bit resource than process.

    Use multiprocessing when your application depend on someone's application that not open-source or a complex one (so you can't port it to your application to become a thread) or a-non-thread-safe one.

  4. #4
    Registered User C_ntua's Avatar
    Join Date
    Jun 2008
    Posts
    1,853
    Process theoretically have also the advantage that if one process fails, the rest will remain. In some cases you would want that. Theoretically, because maybe some OS will kill everything create from the father process.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. fork() inside a thread
    By rpalmer in forum C Programming
    Replies: 3
    Last Post: 05-25-2007, 02:29 AM
  2. API Thread HEADACHE
    By WaterNut in forum Windows Programming
    Replies: 11
    Last Post: 01-16-2007, 09:10 AM
  3. C++ Threading?
    By draggy in forum C++ Programming
    Replies: 5
    Last Post: 08-16-2005, 12:16 PM
  4. Child window inside child window
    By Magos in forum Windows Programming
    Replies: 13
    Last Post: 04-20-2004, 06:51 AM
  5. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 01:37 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21