Home > Back-end >  What happens when a thread execve() a file?
What happens when a thread execve() a file?

Time:11-30

Does this wipe out all threads adress space, since exeve() deletes everything and adress space is shared among threads, resulting in many copies of the execve'd file running simultaneously with whatever register values were present at execve's call time (in particular the program counter will be different in each) ?

CodePudding user response:

This is explained in the man page:

All threads other than the calling thread are destroyed during an execve(). Mutexes, condition variables, and other pthreads objects are not preserved.

The new program starts with just one thread. The alternative would be unworkable.

  • Related