I have one application which has several different threads. Then I forked with fork() but found the child process has to recreate those threads. Is that possible to copy the threads during the clone? Thanks!
Asked
Active
Viewed 224 times
0
-
What language are you using? That might be relevant to the answer. – Ben Regenspan Nov 06 '09 at 02:38
-
I would guess C, but it may be helpful to know which OS, and are these pthreads or what? – James Black Nov 06 '09 at 02:39
-
Oh, I am also guessing Linux is the OS. :) – James Black Nov 06 '09 at 04:05
1 Answers
1
If you are using Unix, in C then the fork() should be creating all the new threads, if you are forking after the threads have been created, but this will lead to duplicating of using resources, so can be a problem.
http://gauss.ececs.uc.edu/Users/Franco/ForksThreads/forks.html
This article talks about a problem using fork in a multi-threaded application, and they reference a web page and the page is below: http://www.viraj.org/b2evolution/blogs/index.php/2007/02/10/threads_and_fork_a_bad_idea
http://www.lsgalilei.org/glibc-doc/Threads-and-Fork.html
This question should have the answers you need, btw: fork and existing threads?

Community
- 1
- 1

James Black
- 41,583
- 10
- 86
- 166
-
-
When you have the actual answer can you please post that as an update to your question, so that if someone else has the same type of problem it can help them. – James Black Nov 06 '09 at 19:08