# Processes, threads and system calls: GATE CS question with solution

From the GATE Daily set of 27 October 2026, question 8 of 10 (https://gatedaily.in/q/2026-10-27-what-threads-of-a-process-share/). Difficulty: easy.

### Q.8 · Operating Systems · Processes, threads and system calls · MSQ, 1 mark (choose every correct option)

A single process has several threads. Which of the following are shared by all the threads of this process?

(A) Global variables in the data segment
(B) The value of the stack pointer
(C) The table of open file descriptors
(D) The contents of the general-purpose registers

**Answer:** (A) Global variables in the data segment; (C) The table of open file descriptors

**Solution.** **Method.** Split the state into what belongs to the *process* and what belongs to each *thread of execution*.

- Per process (shared by its threads): the address space (code, global/static data, heap), open files, and other OS resources.
- Per thread (private): program counter, registers, stack pointer and the stack itself, thread state.

So globals (a) and the open-file table (c) are shared; the stack pointer (b) and register contents (d) are not.

**The trap.** The stack is *in* the shared address space, so another thread could reach it through a pointer; but each thread has its own stack and its own stack pointer value. "Shared address space" does not mean "shared execution context".

**What was tested.** The basic thread/process split: a thread is an execution context (PC, registers, stack) running inside a process's shared resources.

**Remember:** Threads of one process share the address space (code, globals, heap) and OS resources such as open files; each thread has its own program counter, registers and stack.

**Why each option:**
- (A) Shared: all threads run in one address space, so a global written by one thread is seen by the others.
- (B) Not shared: each thread has its own stack, so each keeps its own stack pointer.
- (C) Shared: open files belong to the process, so a file opened by one thread can be used by another.
- (D) Not shared: each thread has its own register context, saved and restored when threads are switched.
