Shared Libraries under Sun-4

Geoffrey Macartney unido!ecrcvax!ecrcvax!geoffrey at uunet.uu.net
Thu Jul 13 01:46:03 AEST 1989


Has anyone had any success storing the executables from their programs as
shared libraries under Sun-4? I have a couple of questions:

To quote from the Sun documentation on shared libraries - "As long as the
text bound-in at run-time is not subsequently modified (say, by a
link-edit operation or an update to initialised external data), it remains
shared among the various (disparate) programs that use it. However, if the
text of a shared routine should need to be modified by a process during
the course of execution, local (exclusive) copies of the affected pages
are created and maintained."

Question 1:
	Are there any tools/utilities available that will allow
me to see when this happens (i.e. when a local copy of a text 
page is created because a datum in it has been modified)?
How do I know to what extent my shared library is really shared?

Question 2:
	Why "_external_ initialised data" in the definition above?
As I understand it the problem of pages becoming non-shared arises
because initialised data is allocated in the segment in which  it
is declared - hence if a process wants to modify some item in a 
shared library it must create its own copy of the relevant page.
So what does it matter whether the process refers to the data
item directly or via some function? eg.

----- library --------
:
:
static int count = 0;
int number = 0;

increment() {
	count++;
}
:

----------------------

----- some program -----

extern number, increment();

....
	number += 2;
	increment();
....

-------------------------

Surely both of these statements change the value of an item that has been
allocated in the shared library, even thought only one of them is
"external"?

Question 3: (the stupid question)
	How come if items in the 'data' (initialised data) segment
get modified it's counted as a modification to the text segment anyway??



Thanks in advance for help, replies by e-mail please unless it's 
really instructive :-)

----------------------------------------------------------------------------
Geoff Macartney 		European Computer Industry Research Centre
Arabellastr 17, 8000 Muenchen 81. West Germany.  Tel. + (49) 89-92699-185
USA     geoffrey%ecrcvax.uucp at pyramid.pyramid.com
        ..!pyramid!ecrcvax!geoffrey
EUROPE  ..!unido!ecrcvax!geoffrey
        geoffrey at ecrcvax.uucp
----------------------------------------------------------------------------



More information about the Comp.sys.sun mailing list