GATE / CS ARCHIVE

GATE CSE 2017 SET 2 / QUESTION 7

GATE CSE 2017 Set 2 Q7

Operating Systems · Processes, Threads & System Calls · Full GATE CSE 2017 Set 2 paper

GATE 2017 Set 2, Q7 1 mark · MCQ
Report issue

Processes, Threads & System Calls

Question 7, GATE 2017: Which are shared by all threads of one process? I:program counter. II:stack. III:address space. IV:registers. A:I and II. B:III only. C:IV only. D:III and IV.
Tap to enlarge
Your answer
Answer & solution

Official answer: B

1. Threads belong to one process and operate in its common virtual address space, including code, global data and heap. Thus III is shared.

2. Each thread may be executing a different instruction, so it needs its own program counter and saved register values. Sharing one program counter or register context would prevent independent execution.

3. Each thread also needs its own call stack for local variables, return addresses and nested calls. Although another thread may access that stack through an address in the shared memory, the execution stack is still distinct. Hence only III is correct, B.

Original paper, page 4 · Answer key