Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!rice!sun-spots-request From: unido!ecrcvax!ecrcvax!geoffrey@uunet.uu.net (Geoffrey Macartney) Newsgroups: comp.sys.sun Subject: Shared Libraries under Sun-4 Keywords: SunOS Message-ID: <152@brazos.Rice.edu> Date: 12 Jul 89 15:46:03 GMT Sender: root@rice.edu Organization: Sun-Spots Lines: 71 Approved: Sun-Spots@rice.edu X-Sun-Spots-Digest: Volume 8, Issue 72, message 6 of 14 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@pyramid.pyramid.com ..!pyramid!ecrcvax!geoffrey EUROPE ..!unido!ecrcvax!geoffrey geoffrey@ecrcvax.uucp ----------------------------------------------------------------------------