Other *NIX apps

Jon maddog Hall maddog at li.org
Wed Apr 16 18:15:25 EDT 2003


>Maddog probably knows more about this

My ears were burning, so I knew I had to say something about this....

>I know that all *NIX versions (Solaris, HPUX, Linux, etc.) have their
>own little nuances, but deep down (and in some cases, really, *REALLY*
>deep down) they are supposedly all the same. This makes me wonder: Is it
>possible to run an old Solaris-based program on a Linux system? Just how
>interoperable are all of these different *NIX system? Just some fodder
>for discussion....

Actually, deep, deep down they are all different.  It is just the thin veneer
of the system call interface that makes the different kernels look anything
alike.

As an example, I once did a comparison of the differences of the V4.2 BSD
system call interface and the System 5.0 system call interface.  Since it was
a long time ago, I have forgotten the actual number, but I think it was around
154 different system calls in BSD, and 155 in System 5.0  Of those, the 154
system calls were EXACTLY the same, and the one extra in System 5 was for
hardware control, and not exactly anything that any "general" program would
handle.

At a level above that, at the library level, there were thousands of interfaces,
and lots and lots of differences between BSD and System V.  Therefore to get
binary compatibility, either the libraries had to be ported to the opposite
kernel, or the application had to be statically linked (in effect taking the
libraries over to the other kernel).

Now, as a lot of people have pointed out, there are issues of passing
arguments from the library to the system call level.   These tend to be set
by the people writing compilers, who tend to take that from existing software
for that system.  It is kind of a catch-22 situation.  In order to have
a cross-development system (nice to have in the early days of a port), you
might want to have existing tools and libraries working on your system.  So
it is easier to duplicate the existing calling standards than to whip out your
own.  Ergo, Linus made his calling standards the same as Digital Unix's, and
I am sure a lot of other people do the same.  It just makes it easier.

This means the libraries, linkers, loaders, etc. have more of a chance of
working with less effort than if you had invented your own.  In this case the
GNU compilers already existed for the Alpha, they followed the calling standard,
so why should Linus re-invent the wheel?

People have mentioned POSIX, and some pointed out that it is a source code
standard.  This is true, but even source code standards (with their ability
to spell out things like file content, data placement, etc.) make having
a binary "standard" easier to achieve.  But without that actual standard
(iBSC, for instance) you have almost no prayer at all of something working
unless someone has done something sneaky like creating a compatibility layer
and switch as we did with Digital Unix, allowing it to run both System V and
Digital Unix native applications.  Sun has added Linux compatibility to
Solaris, probably by porting Linux libraries to Solaris (perfectly legal).
Certainly Solaris was one of the design centers of Linux, after reviewing
Linus' early attempts at recreating POSIX from the outside in.

Finally, I should explain my comment about how the systems are different
underneath that thin veneer of system call interface.

At a minimum, Digital took OSF/1 from the OSF research labs and:

	o replaced its NIS and NFS subsystems
	o replaced its TCP/IP system
	o replaced its scheduler
	o replaced sections of its VM
	o added SMP (with hooks already there)
	o added soft realtime (with hooks already there)

without breaking binary compatibility with applications written to the
system interface and library interface level of code.

Sun completely gutted the System V kernel and replaced it with code underneath,
then called it "Solaris".

In addition, there have been binary compatible versions of Linux that run on
top of a microkernel as well as the monolithic kernel.

So you can see that the STRUCTURE of the kernel code underneath can be
completely different, as long as the interface level of the code is the same,
and if all the outside dependencies are the same, then there can be binary
compatibility.

But it hardly ever comes for free.  Usually someone has to put a lot of work
in to get it, and there has to be a lot of planning.....something about no
free lunch, and no free beer.

md
-- 
Jon "maddog" Hall
Executive Director           Linux(R) International
email: maddog at li.org         80 Amherst St. 
Voice: +1.603.672.4557       Amherst, N.H. 03031-3032 U.S.A.
WWW: http://www.li.org

Board Member: Uniforum Association, USENIX Association

(R)Linux is a registered trademark of Linus Torvalds in several countries.




More information about the gnhlug-discuss mailing list