Operating system inside

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?

  • If a thread calls exec(), exec()does the program specified in the to parameter replace the entire process, including ALL threads?

  • Are system calls proactive? For example, is it possible to schedule a process in the middle of a system call?

+3
source share
2 answers

For exec, from man execve:

All threads except the calling thread are destroyed during execve().

From man fork:

- , fork().

+4

W.r.t. # 3: , , . , , , .

+1

All Articles