Which of the following choices given in the options is/are not shared ...
Multiple threads of the same process share other resources of process except 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.
Thread of the same process doesn't share program counter (register), stack, registers
Which of the following choices given in the options is/are not shared ...
Registers:
Registers are small, high-speed memory locations within the CPU that store data that is being actively used by the CPU. Each thread in a process has its own set of registers. These registers include the program counter, stack pointer, and general-purpose registers. Therefore, registers are shared by all the threads in a process.
Program Counter:
The program counter is a register that holds the memory address of the next instruction to be executed. Each thread in a process has its own program counter, which keeps track of the execution flow for that particular thread. Therefore, the program counter is shared by all the threads in a process.
Stack:
The stack is a region of memory used for storing local variables, function call information, and other temporary data. Each thread in a process has its own stack, which is used for storing the local variables and function call information specific to that thread. Therefore, the stack is not shared by all the threads in a process.
Address Space:
The address space is the virtual memory space provided to a process. It includes the code, data, and stack segments of the process. Each thread in a process shares the same address space, which means that they can access the same code, data, and stack segments. Therefore, the address space is shared by all the threads in a process.
Summary:
- Registers are shared by all the threads in a process.
- The program counter is shared by all the threads in a process.
- The stack is not shared by all the threads in a process.
- The address space is shared by all the threads in a process.
Therefore, the correct answer is option 'A,C' as registers and stack are not shared by all the threads in a process.