Which of the following components of program state is shared across threads in a multi-threaded process?
My suggestion; Only global variables, global variables are allocated on the heap? So Heap memory and Global Variables. Is this correct?
Which of the following components of program state are shared across threads in a multithreaded process? The threads of a multithreaded process share heap memory and global variables. Each thread has its separate set of register values and a separate stack.
In a multi-threaded process, all of the process' threads share the same memory and open files. Within the shared memory, each thread gets its own stack. Each thread has its own instruction pointer and registers.
Register values and stack memory are not shared across threads as it is private to each thread.
Answer and Explanation: Multi-threaded process threads share the (b) Heap memory and (c) Global variables. They have private register values and stack segments.
Heap memory always.
Global variables depends on platform, usually they are shared.
Stack is thread-specific, as well as registers.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With