Two threads inside the same process share
Astack and registers but not heap
Bthe program counter but not the heap
Ceverything, including stack and registers
Dheap, globals, open files; NOT stack or registers
Answer & Solution
Correct answer: D. heap, globals, open files; NOT stack or registers
Threads share the process-wide resources: heap, globals, open file table, code segment.
Each thread has its OWN stack (so function calls don't collide) and its OWN registers (its current CPU state).
The TCB stores the per-thread bits; the PCB stores the shared bits.
Confusing this leads to subtle race conditions and stack corruption.
Keep practising Operating Systems
Browse all Operating Systems questions for GATE CSE, or explore more Computer Science topics.
Related questions
On a MULTI-CORE system, a SPIN LOCK is generallyA LIVELOCK differs from a DEADLOCK in thatSuppose thread A acquires lock L1, then thread B acquires lock L2. Now A tries to acquire A CRITICAL SECTION isA LOCK is considered FAIR ifA LOCK (mutex) is used by concurrent threads toWhich of the following is NOT typically minimised by a CPU scheduler?The PRIMARY DISADVANTAGE of FIFO scheduling is