I do some recursive computation and like to divide the work to multiple CPUs. However, when inside some recursive work, it is very elaborate to get a new thread continue where we currently are, without the overhead of an artifical adressing-scheme to the recursed structures.
For large scale operations, fork() does this nicely as the resulting child process continues the work, just deciding for other tree pathes depending on its id.
For smaller works, fork() is too heavyweight to be useful, especially when complex memory mapping would be needed to integrate the results of all child processes.
Is there any thread framework that acts like fork()
and may continue the new thread from the current execution location?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…