Restarting threads in a bifurcated process

I know that there is no standard way to deploy a multi-threaded process. However, it occurs to me that since the forked process is an exact copy or the original process, there will be stacks of threads.

Does anyone know how to restart threads from their last run state in a forked process. For simplicity, it can be assumed that no locks were found during branching. Say, for example, the markings were made between two obstacles.

+5
source share
3 answers

The execution state of threads is not just data on the stack. It is also a set of CPU registers that is lost.

do_fork() , syscall do_forkcopy_process copy_thread 1181

retval = copy_thread(clone_flags, stack_start, stack_size, p, regs);
+3

, ? Solaris ​​ forkall! Linux!

+1

I think you are talking about sequels . I saw some hits on google (I requested "continuation c"), but I can not recommend any link, since I do not know your specific needs.

0
source

All Articles