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.
- A. 4
- B. 3
- C. 2
- 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
- A server uses a fixed pool of 8 worker threads, and each request does a blocking database call taking 90% of its time. Roughly how many…
- Which statement about user-mode and kernel-mode stacks is correct?
- A process gets SIGSEGV writing to a page marked read-only that belongs to a copy-on-write mapping after fork(). Why is this NOT what…
- A system uses paging with a 2-bit protection field (read, write) in each PTE and the CPU also has an execute-disable bit. Which page…
- Swap space is configured at 2 GB, RAM is 8 GB, and the OS uses overcommit. A process mallocs 20 GB and touches only 1 GB. What happens on…
- Which algorithm decides WHICH process to kill when Linux runs out of memory?