From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (from weis@localhost) by pauillac.inria.fr (8.7.6/8.7.3) id XAA15861 for caml-red; Mon, 4 Dec 2000 23:06:54 +0100 (MET) Received: from concorde.inria.fr (concorde.inria.fr [192.93.2.39]) by pauillac.inria.fr (8.7.6/8.7.3) with ESMTP id WAA31741 for ; Mon, 4 Dec 2000 22:43:27 +0100 (MET) Received: from moutvdom01.kundenserver.de (moutvdom01.kundenserver.de [195.20.224.200]) by concorde.inria.fr (8.11.1/8.10.0) with ESMTP id eB4LhQP11165; Mon, 4 Dec 2000 22:43:26 +0100 (MET) Received: from [195.20.224.220] (helo=mrvdom04.kundenserver.de) by moutvdom01.kundenserver.de with esmtp (Exim 2.12 #2) id 1433OI-0000qp-00; Mon, 4 Dec 2000 22:43:18 +0100 Received: from drms-3e364b94.pool.mediaways.net ([62.54.75.148] helo=ice.gerd-stolpmann.de) by mrvdom04.kundenserver.de with esmtp (Exim 2.12 #2) id 1433OH-0007Uw-00; Mon, 4 Dec 2000 22:43:17 +0100 Received: from localhost (localhost [[UNIX: localhost]]) by ice.gerd-stolpmann.de (8.9.3/8.9.3) id WAA25203; Mon, 4 Dec 2000 22:43:09 +0100 From: Gerd Stolpmann Reply-To: gerd@gerd-stolpmann.de Organization: privat To: John Max Skaller , fabrice.le_fessant@inria.fr Subject: Re: Dynamic loading. Again. Date: Mon, 4 Dec 2000 22:06:52 +0100 X-Mailer: KMail [version 1.0.28] Content-Type: text/plain Cc: Vitaly Lugovsky , caml-list@inria.fr References: <14887.46228.317525.40290@cremant.inria.fr> <3A27D683.5C34212E@ozemail.com.au> In-Reply-To: <3A27D683.5C34212E@ozemail.com.au> MIME-Version: 1.0 Message-Id: <00120422430804.00625@ice> Content-Transfer-Encoding: 8bit Sender: weis@pauillac.inria.fr On Fri, 01 Dec 2000, John Max Skaller wrote: > Suppose I load library X. It gets mapped to > > 0xFF00-0000 > >Now suppose YOU load library X. It is already in memory. >The loader knows that. It gets mapped to > > 0xFF00-0000 > >The same address for both of us. Now I load Y, and you load Z. >Y loads first, under X. Then Z loads, under Y. >Or the other way around: the order doesn't matter, but the >address space used had better be the same. We all share >the same physical memory at the same address (for the shared >libraries). This is impractical. What about libraries loading libraries, especially libraries loading system libraries? System libraries are loaded at addresses you cannot determine, and the loader will probably load the system library at different addresses for different processes. So your patching approach will fail, and you have to work around the problem. (Unless you have your own operating system...) The world uses a different solution, and it does not make sense to build a parallel world with its own rules. Furthermore there are very good reasons not to patch the text segment: - The startup time of executables is much shorter (relocation on demand) - The number of libraries per system is not limited by the address space. Say you have 1GB for shared libraries, and every library is 512k ==> maximum number of libraries per system = 1GB / 512k = 2048 This is rather small for big systems, and may be even much smaller because of the next issue - No artificial fragmentation of the address space: Because of unloading libraries that are no longer used the address space of the whole system will be fragmented. Perhaps you get into the situation that you cannot load a big library because you do not find a free region of addresses that is large enough - It is possible to load the same library several times because the read-write mapped sections of the library (i.e. global variables) can be mapped twice at different addresses - It is not necessary to move text segments of libraries to swap files if the library is swapped out; the already working image of the text segment can be reloaded from the original library file Of course, on the IA32 the code of shared libraries runs slower; however this is not true for properly designed processors. For C code, the factor is 5% to 20% depending on the nature of the code. I do not see any good reason why a comparable factor could not be reached for O'Caml. Gerd -- ---------------------------------------------------------------------------- Gerd Stolpmann Telefon: +49 6151 997705 (privat) Viktoriastr. 100 64293 Darmstadt EMail: gerd@gerd-stolpmann.de Germany ----------------------------------------------------------------------------