in Operating System
13,828 views
27 votes
27 votes

Which one of the following is NOT shared by the threads of the same process ?

  1. Stack
  2. Address Space
  3. File Descriptor Table
  4. Message Queue
in Operating System
13.8k views

2 Comments

Threads don't share stack, program counter and registers, shares code, data, heap and files.
11
11
what do they mean by message queue?
4
4

4 Answers

30 votes
30 votes
Best answer
Stack is not shared
selected by

4 Comments

It is true that each thread has it's own stack and program counter. But threads are not independent on each other. Because all threads can access every address in the task, a thread can read or write every other thread's stack.

Taken from Galvin chapter 4(Thread Structure - Para 4)

So can someone please explain if it has anything to do with same or different process?
2
2
No. It can access its own stack
0
0

@Sankaranarayanan P.N can please explain what is message queue?

0
0
12 votes
12 votes

Threads Share

  • Code   
  • Data  
  • File Descriptor table
  • Address spaces 
  • Message Queue
  • heap
  • gloabal varaibles
  • accounting information

these things are shared as two threads of the same process are doing same kind of work on different instances and these things don’t get changed while they are doing the task

Threads don’t Share

  • Registers
  • program counter
  • Stack

During performing a task above things get changed so they are not shared by threads

takeaway: Things which will get changed while a task is performed and may affect other task if we use them for other task too cannot be shared.

Answer(A) Stack

edited by
by
10 votes
10 votes
Threads have their own stack and registers , although resources like code , data , files and memory is shared.
4 votes
4 votes
Stack,program counter and register is not shared by thread.

So A is the answer.

1 comment

How is file descriptor table and message queue related to threads??
1
1
Answer:

Related questions