rbbb@rice.edu (04/01/87)
> There is a third and much more efficient way: > Shared resident libraries. This is a good idea, but how are they implemented/administered? VMS has these, and they are great when used intelligently (I ran a VMS machine once, so of course they were used intelligently :-), but their administration under VMSes 2.* and 3.* left something to be desired. There, to install a library or an image as shared required special privileges. This was partly because of the consumption of Valuable System Resources, partly because of the security problem (can you say Trojan termites?), and partly because VMS also allowed shared programs and libraries to run with special privileges (remember that VMS has a much more fine-grained allocation of privileges than Unix). I believe under VMS 2.* that an uncoordinated library replacement could crash the machine, too, but this was definitely fixed in one of the later version of 3.*. There is also the Simple Matter of Implementation (reference-counts on your pages, more things that Must Be Done when a process/"image" exits). You have to be careful here, or you might end up with the famed process-creation non-performance of VMS. Think also about debugging code that links against a shared library. Comments (administration, implementation, interactions) on how it is done in later versions of VMS, Apollo, versions of Unix? Send them to me, I'll summarize. David
jfh@killer.UUCP (04/03/87)
While at Pinnacle Systems in Dallas America, John Bremsteller and I played with the idea of shared libraries. The method we used was quite simple. (simple methods for simple minds :-) We created a shared memory segment into which we copied a file containing an array of pointers to the routines and the routines themselves. The offsets into the array were predefined. The file was created by relocating the base of the text segment to some address and linking all of the parts together. We then wrote a program that would extract the text segment of this a.out file. The text was copied into the shared memory segment. Then, we wrote stub routines in /lib/libc.a that called these routines. When you linked with these routines, you got a stub with an indirect call to a procedure in the library. The only problem was that you had to attach to the shared memory segment yourself. And you couldn't do much until you did. The big advantage of this was that it was very simple to implement and could probably be implemented on any system that has shared memory without having to make any modifications to the kernel. - john. (jfh@killer.UUCP) No disclaimer. Whatcha gonna do, sue me?