[comp.os.minix] Using shared library in minix/PC

chain@paul.rutgers.edu (Chain Lee) (01/26/89)

I am suggesting that we use shared library subroutines in PC version 
of minix. This can be justified by the following advantages.
	1. Instead of having copies of same library subroutine in 
every executable disk file, and in every code segment of processes, 
we can put only a single copy in the kernel (or a process served as 
shared library host), to be called by all processes using it.
This will save disk and especially memory space in a PC minix where 
there is a 64K/code limitation. Larger programs s.a. fully functioned
kermit can be made able to run and, # processes that can run at the same
time can be increased. It may also be able to make the future window
manager more usable.
	2. Whenever a change is made on a subroutine, there is no
need to recompile the entire system software, instead, only the kernel
needs to be rebuilt. 
	3. There is no compatibility problem. Commands compiled under
original system can still run under the system with shared library.

Although shared codes usually need address translation hardware to
support, shared library subroutines can be implemented in 8088
or 286/386 real mode in software. e.g. a software interrupt
instruction can be used to call  a shared subroutine, as we did to a 
system call. The problem is to decide which subroutine is to be 
present in the shared library and which is not, such that the system 
can benefit the most (the kernel is not too large but commonly used 
subroutines will be present). Candidates may include C runtime, curses, 
and probably the ones found in runtime library of the window manager 
which we are expecting.
The only disadvantage is that a few more instructions need to be 
executed for each shared subroutine call. But if most of the 
subroutines we chosed are long enough, the negative effect can be
neglected.

Chain Lee

michaelw@microsoft.UUCP (Michael Winser) (01/27/89)

In article <Jan.26.01.02.38.1989.16320@paul.rutgers.edu> chain@paul.rutgers.edu (Chain Lee) writes:
>
>I am suggesting that we use shared library subroutines in PC version 
>of minix. This can be justified by the following advantages.

Hear, hear!  One of my favorite features of the QNX operating system
(an message passing system not unlike Minix) was the use of shared
libraries.  Such libraries were mountable (and unmountable) at any time.
Libc.a became a bunch of stub routines that loaded ax with the correct
value and did the correct interrupt.  I'm sure that something similar
could be done on both the PC and the ST.  The result was a hello world
executable that was less than 100 bytes (it may have been less than 25.
The only constraint was that shared library routines could not have any
global or static data.  There are ways of getting around this (QNX had
magic memory in every process' data segment) and for the most part it
does not get in the way.

>
>  [wonderful shared library advantages deleted]
>

>Although shared codes usually need address translation hardware to
>support, shared library subroutines can be implemented in 8088
>or 286/386 real mode in software. e.g. a software interrupt
>instruction can be used to call  a shared subroutine, as we did to a 
>system call. The problem is to decide which subroutine is to be 
>present in the shared library and which is not, such that the system 
>can benefit the most (the kernel is not too large but commonly used 
>subroutines will be present). Candidates may include C runtime, curses, 
>and probably the ones found in runtime library of the window manager 
>which we are expecting.
>The only disadvantage is that a few more instructions need to be 
>executed for each shared subroutine call. But if most of the 
>subroutines we chosed are long enough, the negative effect can be
>neglected.

We never noticed the difference.  For most commands, the time saved in
reading the disk was huge.  For larger applications, we needed the extra
code space anyway.

We eventually implemented an object oriented programming environment that
was almost entirely based on shared libraries and the existing small model
compiler.  Very nice.

All this was done on a 512Kb machine using an 80186.  Since starting
at Microsoft I've been forced back into the world of DOS and OS/2 but
I still like QNX.

Michael Winser
-- 
____________________________________________  _    /) _________________________
|Nothing I say could possibly represent the   \`o_O'  "Oop, ackk, phtt!"      |
|opinions of Bill Gates or Bill the Cat.       =( )=                          |
|______________________________________________  U  ___michaelw@microsoft.UUCP|