CS FundamentalsVery hardGATE CS

How many of these statements about threads are correct? 1. A thread that calls exit() terminates the whole process. 2. If one thread dereferences a NULL pointer and gets SIGSEGV (default action), the whole process dies. 3. A thread's local variables live on its own stack and are invisible to other threads unless their address is shared. 4. fork() in a multithreaded process duplicates all threads in POSIX.

  1. A. 4
  2. B. 3
  3. C. 2
  4. D. 1

Correct answer: B. 3

1–3 are true. POSIX fork() duplicates only the calling thread (which is why only async-signal-safe functions should be used before exec in the child).

More Operating Systems questions

Exams that ask this topic