GATE / CS ARCHIVE

GATE CSE 2024 SET 1 / QUESTION 24

Separate per-thread state from shared process state

Operating Systems · Processes, Threads & System Calls · Full GATE CSE 2024 Set 1 paper

GATE 2024 Set 1, Q24 1 mark · MSQ
Report issue

Processes, Threads & System Calls

Question 24, GATE 2024: Which thread statements are true? A Threads can exist only in kernel space. B Every thread has its own open-file descriptor table. C All threads of a process share one execution stack. D Threads in one process are not protected from each other by default.
Tap to enlarge
Select all that apply
Answer & solution

Official answer: D

Approach: A process supplies a shared resource environment; a thread supplies a separate flow of execution inside it.
1. Thread management can be implemented by a user-space library, by the kernel, or by a combination. Kernel space is not the only possibility, so A is false.
2. Threads of a process normally share the process's open-file descriptor table. One thread's file operations can therefore affect descriptors available to the others. B is false.
3. Each thread needs its own program counter, register state and execution stack so that its calls and local execution can progress independently. A common address space does not mean a common stack, so C is false.
4. The stacks and other memory still lie in the shared address space. Ordinary thread boundaries do not provide the protection boundaries that separate processes have; a thread can access or corrupt another thread's memory. Thus D is true.
Answer: D only.

Original paper, page 16 · Answer key