[openbeos] Re: posix compatibility -- brief history &overview

  • From: "Daniel Reinhold" <danielr@xxxxxxxxxxxxx>
  • To: openbeos@xxxxxxxxxxxxx
  • Date: Mon, 11 Mar 2002 01:24:49 CST

Well, I'm no expert (and have never read a POSIX spec), but I'll take a 
crack...

The original Unix was written largely in C for a specific mainframe 
computer (PDP-7?) at Bell Labs in the early 1970's. It was mostly the 
brainchild of Ken Thompson, who had also written an untyped, threaded-
code interpretive language called B. Dennis Ritchie took B, added 
types, structs, and a few other things, and created C. In fact, C was 
created mostly for the purpose of writing the new OS (which became 
UNIX) in order to avoid having to use assembly language. The core of 
the kernel was written in assembly, but the remainder (and majority) 
was written in C. So it was somewhat portable.

When the mainframe at Bell Labs was upgraded to a new machine, 
Thompson, Ritchie, et al, had to rewrite the OS and C compiler for the 
new environment. Not finding this to be fun, they strove hard to design 
the system so that it had the least possible depencies on the 
underlying hardware. As the Unix system became popular and spread to 
other research labs, universities, and organizations, the system had to 
be ported many other times. It was decided to create a newsgroup to 
foster the spread and standardization of this new sytem, which was the 
start of Usenix.

Much of what was created was built on top of the initial ideas of Ken 
Thompson. The notion of file descriptors and accessing devices thru a 
simple common IO scheme was one of the hallmarks of Unix. Along with 
this, the notion of pipes, redirection, hiearchical file systems, multi
-user access to shared resources, user/password logons, security, etc. 
etc. (I'm sure I've left off many things) became standard across 
implementations. The Usenix group encouraged both the spread of the 
system and the standardization.

Eventually, Unix got big enough that it was decided to get serious 
about standardizing the interface. Too many "slightly off" variations 
of Unix were popping up: Irix, HPX, Aix, Solaris. POSIX was formed in 
order to standardize what being a "Unix" really meant. No one could 
claim to be Unix or Unix compatible w/o meeting the specifications of 
POSIX.

The thing is, so many programmers over the years have cut their teeth 
on Unix systems, that having POSIX compatibility is considered 
desirable by any OS, even if it has another unique API of its own. For 
example, I believe Windows NT (or 2000, whatever the hell it's called 
these days) is POSIX compliant. But obviously, Windows is not Unix. 
Being compliant means that programmers familiar with a Unix system can 
be instantly productive on another platform. It's a hook to lure in 
talent.

The BeOS was not fully POSIX compliant, as I understand, but had enough 
to be familiar and usable to Unix types. For example, the BeOS has its 
own file API with BFile, BDirectory etc. You can program using those. 
Or you can use the classic C stdio interfaces fopen(), fread(), 
fwrite(), fclose(), etc. Or even use the low-level, unbuffered versions 
open(),read(),write(), close(). By having a POSIX layer, an OS does not 
require prospective programmers to have to ditch everything they know 
in order to become familiar with the new OS -- that would be a major, 
killer hurdle. You can't underestimate the power and influence that 30 
years of Unix culture has stamped on the programming community. A new 
OS ignores POSIX at its own peril.

I'm surprised that Manuel stated that strcpy(), for example, was not 
part of POSIX. I always thought that the entire standard C library had 
to be hosted on a system in order for it be POSIX compliant. C and Unix 
are historically very closely tied together. But I won't argue -- I'm 
sure he knows much more about this than I.

Well, that's my overview explanation. I'm sure I've flubbed up on some 
details, but I think the basic gist of it is correct.


>Whenever in doubt about an acroynm, ask Google "<acronym> webopedia" 
>and click the first link :)
>
>http://www.webopedia.com/TERM/P/POSIX.html
>
>Considering I have no experience with it, someone else can fill in the 
>details :)
>
>Andrew
>
>> i am very sorry for this newbie question, but i have read POSIX so 
>> many times
>> now, but i still have no idea what its all about.
>> Since you you mentioned it in one sentence with ANSI C, its probably 
>> a
>> programming standard, am I right?
>
>

Other related posts: