char: 8 bits
short,int,long: 16 bits
Anyone have experience working with such a system? char: 8 bits
short,int,long: 16 bits
Anyone have experience working with such a system?(This release and increase in word size revealed a lot of bugs in the 16 bit only Unix and C compiler -- I recommend reading the porting paper if this sort of thing interests anyone)
Edit: Paper is here https://www.bell-labs.com/usr/dmr/www/otherports/32v.html
To answer your question from the paper, it appears all the other data types were 2 bytes, except for char, which was one byte. And long/float, which were handled specially, I believe by the PDP-11's floating point co-processor "C code for the PDP-11 uses the FP-11 convention for storing long integers"
The PDP-11 has an MMU and supports what's essentially segmented memory (https://gunkies.org/wiki/PDP-11_Memory_Management), with different address spaces for a kernel and for a userspace. It also supports a 22-bit "real" address space, hence when 2BSD and other "older" PDP-11 unixes can use up to 4MB of real memory (and 2.10BSD's kernel actually used more memory than could fit in a 16 bit address space at once -- needing to be manually chunked and loaded in/out of memory. In the release notes (http://www.krsaborio.net/bsd/research/1987/0715.htm) the authors said "Yes, [this is the last release] at least by us; quite frankly, we'd rather sacrifice our chance at heaven than look at a 16-bit machine again.", so it's about as nightmarish as it sounds.
It doesn't support paging, though, so no real virtual memory. I'm not really sure how thorough the process isolation was -- I know in the early releases, there was basically none, and a bad user process would crash the whole machine. I believe by later models (the MMU did change over time) it was "good enough" to keep the userland from crashing the kernel, at least.
Wasn't until 3BSD from Berkeley that proper virtual memory was added -- hence why the kernel's name was changed from /unix to /vmunix. Which is where the "vm" in "vmlinux" comes from, in case anyone's curious.
Didn’t know that myself, thanks for sharing!
Fun. Here's a link to the programmer's guide: http://www.nj7p.org/Manuals/PDFs/Intel/174391-001.pdf pages 2:17-2:22 cover the pointer and data type sizes. Amazing how little things have changed... and how different things are at the same time.
Edit: answered my own question. So this is the obsolete segmentation isolation I’ve always read about!
Yep. It was amazing what you could do with it. 286 was a chip that outside Xenix, Coherent and a few other multiuser OSes never really was fully utilized.
- Coherent
- XENIX 8086
- SINIX (technically on 80186, and derived from XENIX)
- PC/IX
- Minix86
One of the first things I usually do on an old but new to me system is run a small C program that just prints sizeof() of various types, including the ones you mentioned and pointers. Here it is on SINIX, which is the one I can currently run easiest (unit is multiples of sizeof(char) == 1, with normal 8 bit bytes):
char: 1, short: 2, int: 2, long: 4, long long: 4, pointer: 2
So it's almost like you say, but long (and long long) are actually 32 bits.
Standard pointers are 16 bit, which means they address within a segment. There is almost certainly also a way to specify 32 bit far pointers (seg:off), or maybe even 32 bit "huge" pointers (still seg:off, but normalized, so that comparisons work).
- minix 1.0 could run on XT with a floppy disk
- coherent version < 4 could run on AT 286
- Xenix had a 286 version as well
i remember it had one hell of a doorstop book that they referred to as "the lexicon."
So full 386 software didn't run on that. Minix was super fast but there was little you could do with it, sadly.
Of course pretty much all Intel computers still run Minix today as part of Intel's management engine.
Also sizeof(long) was 2 and sizeof(long long) was 4.
Wait what? Doesnt that mean a byte somehow has 16 bits?
Around 1993 or so, before Linux took off, I ran it on a 386SX laptop with 3 megs of RAM. Supposedly earlier versions ran on the 286 but I never tried.