GATE - 2017 | OS | Which of the following is/are shared by all the threads in a process?

GATE - 2017 | OS | Which of the following is/are shared by all the threads in a process?
Posted on 09-02-2022

GATE - 2017 [Operating System]

Question:

Which of the following is/are shared by all the threads in a process?

        I. Program counter
        II. Stack
        III. Address space
        IV. Registers

A

I and II only

B

III only

C

IV only

D

III and IV only

    

Solution:

Option (B) is Correct

First of all, you need to know about processes and threads.
A process, in the simplest terms, is an executing program.
One or more threads run in the context of the process.
A thread is a basic unit to which the operating system allocates processor time.
A thread can execute any part of the process code, including parts currently being executed by another thread.
Each thread has its own stack, register, and PC.
So here address space that is shared by all threads for a single process.

-----------------------------------

Multiple threads of the same process share other resources of the process except for register, stack, and stack pointer. In particular, a process is generally considered to consist of a set of threads sharing an address space, heap, static data, code segments, and file descriptors.

Which of the following is/are shared by all the threads in a process?  I. Program counter II. Stack III. Address space IV. Registers

Thank You