in Operating System edited by
1,807 views
2 votes
2 votes

Which of the following are NOT shared by the threads of the same process?

  1. Stack
  2. Registers
  3. Address space
  4. Message queue
  1. a and d
  2. b and c
  3. a and b
  4. a, b and c
in Operating System edited by
by
1.8k views

4 Comments

In general each thread has its own registers (including its own program counter), its own stack pointer, and its own stack. Everything else is shared between the threads sharing a process.

Why registers cannot be shared?

Each thread needs its own program counter value. (which is a register)

Why stack cannot be shared?

Each thread may have its own calling sequence.

So, C. Stacks and Registers is correct.

Ref: https://cs.stackexchange.com/questions/48345/what-threads-share-in-general

0
0
What is message queue?
0
0
option c
0
0

2 Answers

2 votes
2 votes
Stack and Registers are not shared by threads of same process.

Threads can not share stack (used for maintaining function calls) as they may have their individual function call sequence.

1 comment

@Aman_Singh

You didn't explain the reason for registers?

0
0
0 votes
0 votes

In general each thread has its own registers (including its own program counter), its own stack pointer, and its own stack. Everything else is shared between the threads sharing a process.

Why registers cannot be shared?

Each thread needs its own program counter value. (which is a register)

Why stack cannot be shared?

Each thread may have its own calling sequence.

So, C. Stacks and Registers is correct.

Ref: https://cs.stackexchange.com/questions/48345/what-threads-share-in-general

Answer:

Related questions