We’ve seen how a program can fork a child process.The child process is initially
running its parent’s program, with its parent’s virtual memory, file descriptors, and soon copied.The child process can modify its memory, close file descriptors, and the likewithout affecting its parent, and vice versa.When a program creates another thread,though, nothing is copied.The creating and the created thread share the same memoryspace, file descriptors, and other system resources as the original. If one thread changesthe value of a variable, for instance, the other thread subsequently will see the modi-fiedvalue. Similarly, if one thread closes a file descriptor, other threads may not read
from or write to that file descriptor. Because a process and all its threads can be exe-cuting only one program at a time, if any thread inside a process calls one of the exec
functions, all the other threads are ended (the new program may, of course, create newthreads).