Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!hp-pcd!hpfcso!mjs From: mjs@hpfcso.HP.COM (Marc Sabatella) Newsgroups: comp.sys.hp Subject: Re: The Real Scoop with Shared/Demand Load -- HELP !!! Message-ID: <7370180@hpfcso.HP.COM> Date: 25 Jul 90 15:37:50 GMT References: <543@dptechno.UUCP> Organization: Hewlett-Packard, Fort Collins, CO, USA Lines: 39 >After reading the manual several times, under cc(1) , ld(1) , chatr(1) and >others, I am very confused about the distinction of Shared and Demand Load. This now officially qualifies as one of the Most Frequently Asked Questions. As far as chatr(1) and (ld) are concerned, "shared" and "demand load" are mutually exclusive - all their respective options do is set the magic number on the file to either SHARE_MAGIC or DEMAND_MAGIC (EXEC_MAGIC if you use -N). Well, not quite - they also know that SHARE_MAGIC and DEMAND_MAGIC data segment start addresses must be aligned on a page boundary, and that DEMAND_MAGIC text segments must be aligned within the file on a page boundary. Given that, though, it is up to exec(2) to decide whether to actually share or demand load the thing. Sharing requires read only text, which is why the data segment addresses start on the next page. Demand loading requires page alignment in the file itself. So as it happens, SHARE_MAGIC files are candidates for sharing, but not for demand loading; DEMAND_MAGIC files are candidates for both. And in fact, exec(2) will do exactly that - it will share SHARE_MAGIC and DEMAND_MAGIC files, and will demand load DEMAND_MAGIC files. While there is no technical reason you couldn't have a file which was demand loaded but not shared, there is no magic number which tells exec(2) to do that, so you can't. >My questions are: > >1) If I want shared text among multiple processes running the same > a.out file can I use "Demand Load" model ? As explained above, yes. >2) Does the sticky bit do anything for "Demand Load" executables ? Don't know. -------------- Marc Sabatella (marc@hpmonk.fc.hp.com) Disclaimers: 2 + 2 = 3, for suitably small values of 2 Bill and Dave may not always agree with me