Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

doubt on multithreading  RSS feed

 
manas ranjan mandal
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
what is the meaning of thread sharing the same address space?
 
Chris Hurst
Ranch Hand
Posts: 443
3
C++ Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
For Java threads, if a thread alters a variable an another views that variable it can see the result (Ignoring memory barrier issues).

Historically the phrase comes from if two threads write and read to the same memory address their changes are visible if they share the same address space. As if they don't share the same address space one thread could write to an address say 2000 but a second thread reading address 2000 would not see what the first thread did as they are not the same points in physical RAM i.e. teh OS has mapped thtm to different address spaces.

http://en.wikipedia.org/wiki/Address_space
 
manas ranjan mandal
Ranch Hand
Posts: 97
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for your reply
 
Z Sugiarto
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
guys, just a quick question to reconfirm my understanding.

A process produces several daemon threads,
if a process is killed, what happen to the threads?

my understanding of it is that the child threads will not survive, and be garbage collected?
 
Henry Wong
author
Sheriff
Posts: 23283
125
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if a process is killed, what happen to the threads?

my understanding of it is that the child threads will not survive, and be garbage collected?


When a process is killed, all OS resources, related to that process, are cleared, closed, returned, etc. -- including threads of control which are part of the process.

Henry
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!