I have three questions that cause me many doubts:
If one thread in the program calls fork(), is a new process running to duplicate all threads, or is the new process single-threaded?
fork()
If a thread calls exec(), exec()does the program specified in the to parameter replace the entire process, including ALL threads?
exec()
Are system calls proactive? For example, is it possible to schedule a process in the middle of a system call?
For exec, from man execve:
exec
man execve
All threads except the calling thread are destroyed during execve().
execve()
From man fork:
man fork
- , fork().
W.r.t. # 3: , , . , , , .