forking a thread
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > forking a thread




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    forking a thread  
Brian Raiter


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-29-04 04:34 PM

I know that it's generally a bad idea for a thread in a multithreaded
processes to call fork(), at least under Linux 2.4. Is it still a bad
idea if the child process immediately calls exec()? How about if it
calls dup2() and then execs? If not, what are the problems?

Context: I have a threaded program, not of my own creation, in which
several threads (10-40) act as filters on a huge amount of data (over
1 GB). Currently this program is dependent on the data coming through
the pipes in sorted order. In order to remove this restriction, I'd
like each of these threads to fork off a /bin/sort process.

(Unfortunately, trying to fork off the proper number of sort proceses
before the first call to pthread_create() isn't feasible, not without
a huge rewrite. The idea here is to avoid doing major surgery on this
code, which is non-trivial and wholly uncommented.)

b





[ Post a follow-up to this message ]



    Re: forking a thread  
David Schwartz


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
01-29-04 07:35 PM


"Brian Raiter" <blr@drizzle.com> wrote in message
news:bvc96v$h78$1@drizzle.com...

quote:
>I know that it's generally a bad idea for a thread in a multithreaded > processes to call fork(), at least under Linux 2.4. Is it still a bad > idea if the child process immediately calls exec()? How about if it > calls dup2() and then execs? If not, what are the problems?
It should be just fine. DS




[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:21 PM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register