Skip to main content
GameDev.net gamedev.net
🔒 Locked

Mutli threaded application and fork()

Started by _gl_coder_one_ Sep 16, 2006 at 12:56 PM 0 replies 650+ views
Original Post
_gl_coder_one_
_gl_coder_one_
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
255
255
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.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.