Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Which components of program state is shared across threads in a multi-threaded process?

Which of the following components of program state is shared across threads in a multi-threaded process?

  • Register values
  • Heap Memory
  • Global Variables
  • Stack memory

My suggestion; Only global variables, global variables are allocated on the heap? So Heap memory and Global Variables. Is this correct?

like image 784
Algific Avatar asked Nov 10 '09 21:11

Algific


People also ask

Which of the following components of program state are shared across threads in a multithreaded process quizlet?

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.

What is shared in multithreading process?

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.

What are the components of a process which are not shared across threads in a multithreaded process?

Register values and stack memory are not shared across threads as it is private to each thread.

Which of the following component of program state are?

Answer and Explanation: Multi-threaded process threads share the (b) Heap memory and (c) Global variables. They have private register values and stack segments.


1 Answers

Heap memory always.

Global variables depends on platform, usually they are shared.

Stack is thread-specific, as well as registers.

like image 189
Antti Huima Avatar answered Oct 05 '22 22:10

Antti Huima