Do child threads exit when the parent thread terminates

Solution 1:

There is no parent/child relationship between threads. If thread A creates thread B and then thread A terminates, then thread B will continue to execute.

The exception to this is when the main thread (that is, the thread that runs the main() function) terminates. When this happens, the process terminates and all other threads stop.

Solution 2:

Since C and C++ mandate that returning from the main function kills all running threads, yes, the process should be gone. And since that behavior is done by the runtime the situation should be the same on Linux.