GATE / CS ARCHIVE

GATE CSE 2017 SET 1 / QUESTION 18

GATE CSE 2017 Set 1 Q18

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

GATE 2017 Set 1, Q18 1 mark · MCQ
Report issue

Processes, Threads & System Calls

Question 18, GATE 2017: Threads of one process share: A globals but not heap; B heap but not globals; C neither globals nor heap; D both globals and heap.
Tap to enlarge
Your answer
Answer & solution

Official answer: D

1. Threads are separate execution streams inside the same process address space. Globals live in that shared address space.

2. Heap allocations also belong to the process address space; one thread can pass an allocated object’s address to another. Sharing does not itself make unsynchronized updates safe.

3. Each thread instead has its own execution state, such as registers and program counter, and normally its own stack. Hence both heap and globals are shared, D.

Original paper, page 10 · Answer key