mapping of shared libraries
Web Server forum
Back To The Forum Home!Search!Private Messaging System

Web Server Talk Web Server Talk > Unix and Linux reviews > Free Unix support > Unix Programming > mapping of shared libraries




  Last Thread   Next Thread Next
  Show Printable Version Email this Page Subscribe to this Thread      Post New Thread    Post A Reply      

    mapping of shared libraries  
j0mbolar


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-22-04 11:08 PM

I've read that shared libraries are mapped into memory and shared
amongst processes. If I have a program called "someapp" that uses a
library called
"foobar", and if I have eight instances of "someapp" running, then
they all
supposedly share "foobar". Which makes me wonder, this doesn't sound
right
because if I had a function in my library being shared which had a
static
buffer(say strtok for this example) then the individual processes
would
overwrite or share the data of the function in the shared library.
So if this isn't correct, how then, is the library actually shared
amongst many processes?





[ Post a follow-up to this message ]



    Re: mapping of shared libraries  
Jens.Toerring@physik.fu-berlin.de


View Ip Address Report This Message To A Moderator Edit/Delete Message


 
08-22-04 11:08 PM

j0mbolar <j0mbolar@engineer.com> wrote:
> I've read that shared libraries are mapped into memory and shared amongst
> processes. If I have a program called "someapp" that uses a library called
> "foobar", and if I have eight instances of "someapp" running, then they al
l
> supposedly share "foobar". Which makes me wonder, this doesn't sound right
> because if I had a function in my library being shared which had a static
> buffer(say strtok for this example) then the individual processes would
> overwrite or share the data of the function in the shared library.  So if
> this isn't correct, how then, is the library actually shared amongst many
> processes?

The text section (i.e. the code) of the libraries is shared between
processes using the library but not the data sections (e.g. static
buffers etc.), of this each process gets its own set.

Regards, Jens
--
\   Jens Thoms Toerring  ___  Jens.Toerring@physik.fu-berlin.de
\__________________________  http://www.toerring.de





[ Post a follow-up to this message ]



    Re: mapping of shared libraries  
bob holder


Report This Message To A Moderator Edit/Delete Message


 
08-22-04 11:08 PM


"j0mbolar" <j0mbolar@engineer.com> wrote in message
news:2d31a9f9.0408200658.238002d@posting.google.com...
> I've read that shared libraries are mapped into memory and shared
> amongst processes. If I have a program called "someapp" that uses a
> library called
> "foobar", and if I have eight instances of "someapp" running, then
> they all
> supposedly share "foobar". Which makes me wonder, this doesn't sound
> right
> because if I had a function in my library being shared which had a
> static
> buffer(say strtok for this example) then the individual processes
> would
> overwrite or share the data of the function in the shared library.
> So if this isn't correct, how then, is the library actually shared
> amongst many processes?

The text (code) segment of the shared library would be shared among the 8
someapp processes. The shared library's data segment would be COW and
unique.

bob







[ Post a follow-up to this message ]



    Sponsored Links  




 





   All times are GMT. The time now is 09:31 AM.      Post New Thread    Post A Reply      
  Last Thread   Next Thread Next


Most Popular forums 

Forum Jump:
Rate This Thread:

Forum Rules:
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is OFF
vB code is ON
Smilies are ON
[IMG] code is OFF
 
Medical and Health forum | Computer Games Reviews | Graphics design forum

Back To The Top
Home | Usercp | Faq | Register