Find the answer to your Linux question:
Results 1 to 4 of 4
I have a project to convert the existing multiple process model to multiple thread model. Beside the benefit I can get from the multiple thread model (NO more IPC, yes), ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Aug 2005
    Posts
    19

    create multiple thread under one thread


    I have a project to convert the existing multiple process model to multiple thread model. Beside the benefit I can get from the multiple thread model (NO more IPC, yes), one real concern is that I have to create multiple thread under one of the thread.
    The story is like this, the main program should create several threads (to replace the processes), and one of the thread should create its own multiple threads (to mapping the old design). The question are:
    1. is this design work?
    2. if this design work, what is the possible problem for multiple level thread. can the subthread of the thread directly communicate with the main program?

    Please let me know if you have similar experience before, I like to know.
    Thanks.

  2. #2
    Super Moderator Roxoff's Avatar
    Join Date
    Aug 2005
    Location
    Nottingham, England
    Posts
    3,879
    The design seems ok, I presume you'll have a number of top level threads running which will each, from time to time, spawn new, short-lived threads for specific tasks.

    Bye bye to IPC, hello memory locking/mutext/semaphore headaches.
    Linux user #126863 - see http://linuxcounter.net/

  3. #3
    Linux Guru lakerdonald's Avatar
    Join Date
    Jun 2004
    Location
    St. Petersburg, FL
    Posts
    5,035
    Seriously, why would you do that? UNIX was created with cheap process spawning in mind.
    Is it a matter of resources? Because a fork() is very cheap on *NIX.

  4. #4
    Linux User
    Join Date
    Aug 2005
    Location
    Italy
    Posts
    401

    Stability...

    And don't forget that process are quite independent from each others... only if a father fails something other childs are affected... other parent processes are unaffected, so you can manage processes and restart them if possible...

    If you use threads, a single failure in a single thread will shot down the entire application...
    When using Windows, have you ever told "Ehi... do your business?"
    Linux user #396597 (http://counter.li.org)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •