Tuesday, August 25, 2009

Putting the PDP-11 in perspective, and the 64k barrier

I just updated the Wikipedia PDP-11 article to reflect what really happened to it, and why it's really important to computers today. I worked summers in the late 70s at Hewlett Packard and in the early 1980s at DEC and Data General as the PDP-11 died off. The HP computer software was much clunkier than DEC, though the HP 3000 was rock solid in terms of staying up in operation. HPs were in industry, but there were none in computer science labs. One day I thought, HP would build real computers - and now they're the biggest computer company, having bought out the remains of DEC after it (and every other New England based computing company) collapsed after the 1980s.

A minicomputer was originally a computer the size of a refrigerator as opposed to something that took up most of a room if not a building. It used to be something that you could attach up to 64k bytes of memory which cost an awful lot, and was made of boards that plugged into a box with a front panel with blinking lights and switches. The PDP-8 was based on having on accumulator register, and a guy who suggested doing a better one was turned down, and he moved down I495 to found Data General and the Nova. Hewlett Packard bought a company that built a computer with an AX and BX registers which became the 2100/HP1000, and Intel down the street from HP would start with 1 accumulator on the 8080, then put AX, BX, CX and DX registers in the Pentium to this very day. The PDP-11 introduced the idea of 8 general registers, r1 through r8, using one as a stack register, which is much of the reason that programmers to this day hate the Intel architecture with a passion. On the 64bit, AMD's extension to x86 has registers r9 to r15, PDP-11 style.

The PDP-11 was the 2nd platform for Unix after the PDP-7, but when it was ported to the PDP-11/20, it was the first to be offically called Unix, and PDP-11 features inspired the infamous byte features of the C language which was used to rewrite Unix in the high level language, which was pretty unusual but not a first. The big thing that killed it was the infamous 64k barrier which is what happens when it's cheap enough to add megabyte(s) to a processor that doesn't have registers with enough bits to count beyond 64k. There were workarounds (using bank switching, used to extend the PDP-8 beyond 12 bits / 4K, and the IBM PC beyond 20 bits / 1M) but they were awkward and not a real alternative to flat addressing. The HP3000 segmented architecture got around the 64k barrier because it was already based on segments. As long as no single code routine was over 64k and no chunk of data was over 64k, you could have lots of 64k code and data segments, and that was fine for COBOL business applications. HP eventually migrated the whole thing to a RISC processor, it wasn't withdrawn until after VAX died.

The VAX-11 extended PDP-11. It partially solved the problem with 32 bit addressing 2G or 4G. We'll never use 2G I thought! Now it takes 64 bit Windows to properly run more than the 2G of RAM you can buy at Target today (late Pentiums also have tricks to get up to 64G of RAM with 32 bit addresses). But the VAX was a monster system, not something that fit in one rack or a desktop. The Motorola 68000 was based on PDP-11 ideas, and was the favorite for desk sized systems with megabytes of memory. It had 32 bit wide registers, but only later could address a full 32 bits of memory. Intel's 808x started with the 8 bit 8080 which had but one accumulator, like the old PDP-8. It got beyond 64k by merely tacking on a 4 bit "segment" address which enabled you to juggle 64k byte segments at a time. It threw a monkey wrench into programming, but as long as hundreds of thousands of these things could run the software, you could afford to pay a few clever guys to get around a chip that was awful to program. (One guy Bill Gates would be paid a LOT) That hack was just good enough for a PC where it was costly to put in 1M of memory. It wasn't until the 386 that Intel got full 32 bit addressing, (the 286 was largely ignored because it couldn't quite hack the full 32 bit trick) but that was enough. The 68000 was popular in the Mac until replaced by RISC, and now it's x86.

Today's multi-core Pentium 64 is still basically a x86 that chugs along as an 8080 with hacks upon more hacks, managing to fend off every more advanced architecture up to Itanium through sheer economies of scale and incremental refinement. The Itanium was a megaproject to replace high-end x86 and other RISC with a super-parallel 64 bit chip. It was assumed that it would be so fast, you could run old x86 stuff by running an emulator. But it turned out that the hardware couldn't compete with the mass numbers of x86 chips that kept advancing in speed, and most commercial apps couldn't use the fancy compilers that nobody seemed to be able to write that would make programs run much faster if you could execute 6 instructions at once. AMD, who made a living copying the x86 thought that was silly, and went ahead and came up with their own hack to extend x86 to 64 bits. It sold so well that Intel had to copy AMD's version, so the x86 today dominates 64 bit chips, though the Itanium has eeked out niche at the very high end (There's a youtube video of how an Itanium smokes AMD for a mandelbrodt set 12 to 1, but then how many of us do that vs web surfing?)

The other problem was when Bill Gates changed the model for operating system by writing one for Intel's 808x which was originally designed to be used for any BUT a general computer. Now most computers run either Windows, a descendent of CP/M which was a port of the PDP-11 operating system, or Unix, which was originally written for the PDP-11 in its 2nd version.

-------------------------------------

The PDP-11 was a series of 16-bit minicomputers sold by Digital Equipment Corp. from 1970[1][2] into the 1990s.[2] Though not explicitly conceived as successor to DEC's PDP-8 computer in the PDP series of computers (both product lines lived in parallel for more than 10 years), the PDP-11 replaced the PDP-8 in many real-time applications. It had several uniquely innovative features, and was easier to program than its predecessors with its use of general registers. The 64k barrier became a significant limitation as megabytes of installed memory became common. It was replaced in the mid-range minicomputer niche by the VAX-11 32-bit extension of the PDP-11.

Smaller personal computers such as the IBM PC, and workstations and servers by vendors such as Sun Microsystems became popular based on standard microprocessors such as the Intel x86 and Motorola 68000, As a PDP-11 based personal computer offering failed in the marketplace, these computers using standard operating systems such as MS-DOS and Unix would eventually evolve up to full 32 bit memory addressing, and replace most proprietary minicomputer and midrange computers including the VAX-11.

Design features of the PDP-11 and its operating systems influenced the design of microprocessors such as the 68000, CP/M and DOS which are still common in current computers and operating systems. The first officially named version of Unix ran on the PDP-11/20 in 1970. The C programming language was written to take advantage of PDP-11 programming features such as byte addressing to rewrite Unix in a high level language.

3 comments:

Lawrence Woodman said...

Interesting article, but that should be 4GB that 32-bits can address not 2GB. Also the PDP-11 later broke through the 64k barrier by paging memory.

Anonymous said...

"Windows", and by that you surely mean "Windows NT" is NOT an outgrowth of CP/M, but rather it's the portable version of OS/2. Windows NT 3.1 was actually OS/2 NT 3.0 (razzle) before the MS/IBM divorce.

MS-DOS was a clone of CP/M called 86-DOS written by a Tim Patterson..

The 286 was *NOT* a 32bit CPU, it was a segmented 16bit cpu, with 64k segments, much like a PDP-11. It was slightly useful with overlays for pretty much of the same reason. However it languished as it had no 'good' way to switch from protected mode to real mode, until Gordon Letwin figured out the tipple fault..

Another thing that held down the 286 was that once DOS extenders did come out, they charged a fortune for them. It's no wonder that Microsoft Windows 3.0 (the first protected mode version of windows) caught on as it was CHEAP ($150 USD), and you could score Quick C for windows for about the same price. Phar Lap's 286 product was in excess of $1000.

It's an interesting article, just with a few holes....

BlArthurHu said...

OS/2 was an evolution of windows, but they a) "improved" every API by enough to make it incompatible and b) based it on the 286 which wasn't worth the effort. The PS/2 similarly strayed too far from "industry" standards relative to the other clones. Windows 3.1 was closer to the original windows, and pretty much rode the 386 to success. Windows NT was a rewrite of windows in a high level language that incorporated capabilities of DEC VMS and UNIX, though to this day it's still not a real multi-user time-share platform.