Mon, Feb. 10th, 2020, 01:15 pm

Apple's long processor journey There have been multiple generations of Macs. Apple has not really divided them up.



1. Original 680x0 Macs with 24-bit ROMs (ending with the SE/30, Mac II, IIx & IIcx)

2. 32-bit-clean-ROM 680x0 Macs (starting with the Mac IIci)

3. NuBus-based PowerMacs (6100, 7100, 8100)

4. OldWorld-ROM PCI-based PowerMacs (all the Beige PowerMacs including the Beige G3 & black PowerBooks) ← note, many but not all of these can run Mac OS X

5. NewWorld-ROM PCI-based PowerMacs (iMac, iBook & later)

6. OS-X-only PowerMacs (starting with the Mirrored Drive Doors 1GHz G4 with Firewire 800)

7. 32-bit Intel Macs (iMac, Mac mini and MacBook Core Solo and Core Duo models)

8. 64-bit Intel Macs with 32-bit EFI (Core 2 Duo models from 2006)

9. 64-bit Intel Macs with 64-bit EFI (anything from 2008 onwards)



Classic MacOS was written for 68000 processors. Later it got some extensions for 68020 and 68030.



When the PowerMacs came out, Apple wrote a tiny, very fast emulator that translated 680x0 instructions on the fly into PowerPC instructions. However, unlike modern retrocomputer emulators, this one allowed apps to call PowerPC code, and the OS was adapted to run on the emulator. It was not like running an Amiga emulator on a PC or something, when the OS in the emulator doesn't "know" it's in an emulator. MacOS did and was tailored for it.



They ran Classic MacOS on this emulator, and profiled it.



They identified which parts were the most performance-critical and were running slowly through the emulator, and where they could, they rewrote the slowest of them in PowerPC code. Bear in mind, this was something of an emergency, transitional project. Apple did not intend to rewrite the whole OS in PowerPC code. Why? Because:

1. It did not have the manpower or money

2. Classic MacOS was already rather old-fashioned and Apple intended to replace it

3. If it did, 68000 apps (i.e. all of them) wouldn't work any more



So it only did the most performance-critical sections. Most of MacOS remained 68K code and always did for the rest of MacOS' life.



However, all the projects to replace MacOS failed. Copland failed, Pink failed, Taligent failed, IBM Workplace OS failed.



So Apple was stuck with Classic MacOS. So, about the MacOS 7.5 timeframe, Apple got serious about Classic.

A lot of MacOS 7.6 was rewritten from assembly code and Pascal into C. This made it easier to rewrite chunks for PowerPC. However it also made 7.6 larger and slower. This upset a lot of users, but it meant new facilities: e.g. the previously-optional "MultiFinder" was now always on, & there was a new network stack, OpenTransport.



This is also the time that Apple licensed MacOS to other vendors.



Soon afterwards, Apple realised it could not build a new replacement OS itself, and would have to buy one. It considered former Apple exec Jean Louis Gassée's Be for BeOS, and Apple co-founder Steve Jobs' NeXT Computer for the Unix-based NeXTstep.



It bought NeXTstep and got Jobs back into the bargain. He regained control, fired Gil Amelio and killed off the licensing program. He also killed Copland, the experimental multitasking MacOS replacement, and got his coders to salvage as much as they could from it and bolt it onto Classic, calling the result MacOS 8.



MacOS 8 got a multithreaded Finder, desktop "drawers", new gaming and web APIs and more. This also killed the licensing programme, which only applied to MacOS 7.



MacOS 8.1 got a new filesystem, HFS+. This still works today and was the default up to High Sierra.



8.1 is the last release for 680x0 Macs and needs a 68040, although a few 68030 Macs work via Born Again.



The "monolithic" / "nanokernel" distinction applies to CPU protection rings.



These days this principally applies to OSes written entirely in compiled code, usually C code, where some core OS code runs in Ring 0, with no restrictions on its behaviour, and some in Ring 3 where it cannot directly access the hardware. IBM OS/2 2 and later uniquely used Ring 1. I've blogged about this before.



OS/2 2 using Ring 1 is why VirtualBox exists.



Decades ago, more complex OSes like Multics had many more rings and used all of them.



If a Unix-like OS is rewritten and split up sop that a minimal part of the OS runs in Ring 0 and manages the rest of the OS as little separate parts that run in Ring 3, that's called a "microkernel". Ignore the marketing, Mac OS X isn't one and neither is Windows NT. There are only 2 mass-market microkernel OSes and they are both obscure: QNX, now owned by Blackberry, and Minix 3, embedded in the control/management circuitry embedded into every modern Intel x86-64 CPU.



Classic MacOS is not a C-based OS, nor is it an Intel x86 OS. It does not have a distinction between kernel space and user space. It does not use CPU rings, at all. Everything is in Ring 0, all the time. Kernel, drivers, apps, INITs, CDEVs, screensavers, the lot.



MacOS 8.5 went PowerPC-only, and in the process of dropping support for 680x0 Macs, Apple made some provision for future improved PowerMacs.



The 68K emulator got a big upgrade to the emulator, now renamed a "nanokernel". It is not an OS in its own right: it boots and runs another OS on top of it.



It is not a HAL: this is native code, deep within an OS kernel, that allows the same OS to run with little modification on widely-different underlying hardware, with different memory maps, I/O spaces, APICs etc., without adapting the kernel to all the different platforms. MacOS 8.5+ only runs on Macs and the hardware could be adapted to the OS and the OS to the hardware. No need for a HAL.



It is not a hypervisor. A hypervisor partitions a machine up into multiple virtual machines -- it allows 1 PC to emulate multiple separate PCs and each virtual emulated PC runs a separate OS. Classic MacOS can't do that and only runs 1 OS at a time.



The MacOS nanokernel is a very small bit of code that boots first and then executes most of the rest of the code, and manages calls from apps from a 68K OS back to code written for the underlying PowerPC CPU.



It'sd a shame that this bit of code is secret and little-known, but some details have been leaked over the years. Mon, Feb. 10th, 2020 10:25 pm (UTC)

waistcoatmark Out of interest, *why* did all their attempts at writing a proper OS fail? I've never really used a Mac in anger, and at the time it was all going on, I didn't really have an idea what an OS was... Out of interest, *why* did all their attempts at writing a proper OS fail? I've never really used a Mac in anger, and at the time it was all going on, I didn't really have an idea what an OS was... Tue, Feb. 11th, 2020 04:52 pm (UTC)

liam_on_linux I am not sure I'm enough of an expert to give a deep analysis, but there were 3 main efforts, and a 4th that they totally missed, which some former staffers tell me was partly due to manpower and internal politics.



1. "Copland" was brave, ambitious, and frankly I think just plain beyond their technical expertise.



2. "Pink" / Taligent -- my personal take is that a spec was never firmly enough nailed down.



Apple's "Pink" became part of Taligent, thus I'm counting it as 2, but exactly what it was never seemed to solidify, despite a _lot_ of money being spent on it.



4. A/UX -- Apple already _had_ a next-gen OS but only for 68K Macs. It never ported it to PowerPC. A/UX was a box-ticking exercise: Apple sold Macs as web servers to the US Army, but US military procurement rules said the vendor had to offer UNIX and be UNIX-compatible. So Apple did a Unix.



https://en.wikipedia.org/wiki/A/UX



The thing is, it was a superb Unix for its time. All the non-PC micro vendors did a Unix!

• Commodore UNIX for the Amiga:

• Atari ST Unix:

• Acorn RISCix:



All were no more like those companies' OSes than any other Unix. All were high-end, expensive, and basically very plain, vanilla Unix implementations.



Apple's had a Mac-like window manager, MacOS integration, could run some Mac apps, could network with MacOS, dual-boot with MacOS... it was very impressive. I own hardware that will in theory run it and it's a long-term plan.



It was mot just another Unix, it was a rather creative blending of Unix and Classic MacOS. It would have been a credible next-gen OS for them, and it shipped in multiple versions.



I'm not sure it was friendly enough for Mac users, but it was more than just a start.



But, like BeOS, which was also technically inspired, it would have been a bad choice.



There were 2 killer features to NeXT:

[1] as well as supreme polish and ease-of-use, best-of-industry dev tools to tempt the developers on board

[2] It got Steve Jobs back.



Without _both_ Apple would be nothing but a fading memory by now.



So what they did was the best option they had. But the screenshots and descriptions of Copland did make me want it very very much...









Edited at 2020-02-11 04:52 pm (UTC) I am not sure I'm enough of an expert to give a deep analysis, but there were 3 main efforts, and a 4th that they totally missed, which some former staffers tell me was partly due to manpower and internal politics.1. "Copland" was brave, ambitious, and frankly I think just plain beyond their technical expertise. https://en.wikipedia.org/wiki/Copland_(operating_system) 2. "Pink" / Taligent -- my personal take is that a spec was never firmly enough nailed down. https://en.wikipedia.org/wiki/Taligent Apple's "Pink" became part of Taligent, thus I'm counting it as 2, but exactly what it was never seemed to solidify, despite a _lot_ of money being spent on it.4. A/UX -- Apple already _had_ a next-gen OS but only for 68K Macs. It never ported it to PowerPC. A/UX was a box-ticking exercise: Apple sold Macs as web servers to the US Army, but US military procurement rules said the vendor had to offer UNIX and be UNIX-compatible. So Apple did a Unix.The thing is, it was a superb Unix for its time. All the non-PC micro vendors did a Unix!• Commodore UNIX for the Amiga: https://en.wikipedia.org/wiki/Amiga_Unix • Atari ST Unix: http://www.atariunix.com/ • Acorn RISCix: https://en.wikipedia.org/wiki/RISC_iX All were no more like those companies' OSes than any other Unix. All were high-end, expensive, and basically very plain, vanilla Unix implementations.Apple's had a Mac-like window manager, MacOS integration, could run some Mac apps, could network with MacOS, dual-boot with MacOS... it was very impressive. I own hardware that will in theory run it and it's a long-term plan.It was mot just another Unix, it was a rather creative blending of Unix and Classic MacOS. It would have been a credible next-gen OS for them, and it shipped in multiple versions.I'm not sure it was friendly enough for Mac users, but it was more than just a start.But, like BeOS, which was also technically inspired, it would have been a bad choice.There were 2 killer features to NeXT:[1] as well as supreme polish and ease-of-use, best-of-industry dev tools to tempt the developers on board[2] It got Steve Jobs back.Without _both_ Apple would be nothing but a fading memory by now.So what they did was the best option they had. But the screenshots and descriptions of Copland did make me want it very very much... Sun, Feb. 16th, 2020 01:00 am (UTC)

(Anonymous) Copland and Pink had the same root issue, which was that executive management never nailed down what it was they wanted to deliver to customers, and so were unwilling to commit at any point to a feature lockdown in order to be able to ship.



NeXT's OS and was, frankly, highly overrated at the time. Try installing and using OpenStep for x86 on a PC of that era and you'll quickly see why. Remember, it took them six years to produce a usable replacement for classic Mac OS (early Mac OS X was painful). The NeXT developer environment was really long in the tooth in 1997 as well.



Management, specifically Steve Jobs, was the important thing. Sun, Feb. 16th, 2020 04:10 pm (UTC)

Matthias Neeracher Yet another Apple sponsored Unix-like OS was MkLinux. Mon, Feb. 17th, 2020 05:39 pm (UTC)

liam_on_linux Good point, yes. I've mentioned it before (long ago) --



A noble effort and it did see several releases, but it did not seem to have much impact on anything.



I have read that some of the work on Mach that was done getting MkLinux working did get reused in the process of porting NeXTstep to the PowerMac after Apple acquired NeXT. Good point, yes. I've mentioned it before (long ago) -- https://liam-on-linux.livejournal.com/22542.html A noble effort and it did see several releases, but it did not seem to have much impact on anything.I have read that some of the work on Mach that was done getting MkLinux working did get reused in the process of porting NeXTstep to the PowerMac after Apple acquired NeXT. Sat, Feb. 15th, 2020 12:36 pm (UTC)

andrewducker Thank you, that was fascinating! Thank you, that was fascinating! Sat, Feb. 15th, 2020 01:21 pm (UTC)

liam_on_linux Thanks! Glad to know anyone reads it and finds it interesting. :-) Thanks! Glad to know anyone reads it and finds it interesting. :-) Sun, Feb. 16th, 2020 10:06 am (UTC)

andrewducker Not just me

https://news.ycombinator.com/item?id=22334900 Not just me Sun, Feb. 16th, 2020 12:21 pm (UTC)

liam_on_linux OMFG.



How come my own submissions go nowhere?!



Thank you... OMFG.How come my own submissions go nowhere?!Thank you... Sun, Feb. 16th, 2020 12:22 pm (UTC)

andrewducker Mine frequently go nowhere too. Glad this one took off! Mine frequently go nowhere too. Glad this one took off!