Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: utzoo!utgpu!water!watmath!clyde!cbosgd!mandrill!hal!ncoast!allbery From: allbery@ncoast.UUCP Newsgroups: comp.unix.wizards Subject: Re: Unix with dynamic loading (was Re: Big Programs Hurt Performance) Message-ID: <4776@ncoast.UUCP> Date: Tue, 29-Sep-87 18:14:30 EDT Article-I.D.: ncoast.4776 Posted: Tue Sep 29 18:14:30 1987 Date-Received: Fri, 2-Oct-87 06:29:21 EDT References: <1665@ncr-sd.SanDiego.NCR.COM) <8579@utzoo.UUCP) Reply-To: allbery@ncoast.UUCP (Brandon Allbery) Organization: Cleveland Public Access UN*X, Cleveland, Oh Lines: 40 [Ncoast has neither comp.arch nor comp.os.misc, so I have restricted this article to comp.unix.wizards. Since I'm talking UNIX specifics, that is probably appropriate anyway. ++bsa] As quoted from <2550@xanth.UUCP> by kent@xanth.UUCP (Kent Paul Dolan): +--------------- | Well, ring my chimes! If this is possible in Unix, it would sure help | the commercial success of Unix if it became common practice. +--------------- System V can do something like this; it can't patch addresses, but it can use the jump-table approach. What works for shared libraries works just as well for loading part of the address space from a file, and using a loader ifile to specify symbol addresses within the dynamically-loaded area. Of course, this requires that the read/write data space of a program have execute permissions in the MMU (does it normally? I've no idea) and pretty much rules out sharing the code; without kernel support, you can't page it in from the dynamic load file, either. Alternatively, the dynamic library could be read by a routine which builds a jump table from the library's namelist, and "stubs" could be written which search the jump table for the actual routine and jump to it. (They could then store the jump address in a static variable for faster access on subsequent calls.) The library itself would be able to access its static variables indirectly through the jump table, with little loss in performance if the dynamic load routine insures that externally visible static variables always have the same offset in the jump table as their symbols have in the namelist. (That was unclear, but I hope at least someone gets the idea I'm trying to get across.) This kind of dynamic loading might be a performance loss, but it would be a major win for making the library truly dynamic. DId I make any sense, or did I come across as a lunatic, or have I got something horribly wrong (I'm a programmer; when it comes to MMU-related stuff, though, I'm out of my depth), or ??? -- Brandon S. Allbery, moderator of comp.sources.misc {{harvard,mit-eddie}!necntc,well!hoptoad,sun!mandrill!hal}!ncoast!allbery ARPA: necntc!ncoast!allbery@harvard.harvard.edu Fido: 157/502 MCI: BALLBERY <> "`You left off the thunderclap and the lightning flash.', I told him. `Should I try again?' `Never mind.'" --Steven Brust, JHEREG