Thread address space...



The sentense "Threads share parent process address space."

in pthrad_create(..), we pass address of function wich acts as body of
thread. Now I dont understand how come a thread shares process address
space. It can just share the global variables which comes under the
data segment. so I think a thread can share following of process,
1. Code segment: NO
2. Data Segment: Only the global variables.

Now, as we pass a function as a body of a thread, it must have a code
segment (correct me If I'm wrong), a stack segment, and data segment
(intitalized variables in functions). then how come we say it's sharing
address space of parent process, just because its sharing its global
variables!!

Regards,
Mozis.

.



Relevant Pages

  • Re: Thread address space...
    ... Data Segment: Only the global variables. ... >address space of parent process, just because its sharing its global ... and that will be true no matter how many threads are ...
    (comp.os.linux.development.system)
  • Re: Thread address space...
    ... Data Segment: Only the global variables. ... On Intel architecture ... On Linux threads share heap. ...
    (comp.os.linux.development.system)
  • Re: global variables in dynamic libraries
    ... If it is in the data segment, is there a limit to the data ... global variables to the dll and expect the exe to work fine? ... every DLL has its own data segment. ... Brüder, in die Tonne die Freiheit, ...
    (comp.lang.c)
  • Re: Where is a static variable stored?
    ... As for data segment, only some OSes have such things. ... loads, memory does need to be reserved for all the global variables, ... including the static locals, which is why you can think of them as local ... void foo() ...
    (comp.lang.c)