Sign in to follow this  

Mutli threaded application and fork()

This topic is 4111 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi all I am working on a multithreaded server , which also needs to fork() and execv() another executable for certain requests from clients. Would like to know what will be the state of the threads in the child process ? Would I have to explicitly terminate the thread in the child before I execv() ? I am using pthreads for multi threading in C++. Thanks

Share this post


Link to post
Share on other sites
In Linux, at least, threads are really processes that share their memory space with each other (see man clone). When a process requests a fork, the other processes (threads) that share its memory space are not (AFAIK) duplicated and the new child process can safely exec what it wants immediately.

edit: search for 'thread' here for some discussion on the subject.

Share this post


Link to post
Share on other sites

This topic is 4111 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this