Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Yup, in the late 80's, and 90's I worked on several AS/400's. The video doesn't mention that not only is SQL a part of the OS, the hardware (microcoded) actually has instructions for SQL. It's part of the CPU!


On the original CISC AS/400 systems, there were two layers of "microcode" - horizontal and vertical. The vertical "microcode" was not really microcode, but was essentially the OS kernel (including the database and the native code generator), mostly implemented in a PL/I dialect. The horizontal microcode was the actual microcode - it implemented the CPU instruction set which the vertical microcode's PL/I code compiled down to. While the horizontal microcode implemented some rather high level things such as processor scheduling, I am almost certain that the database logic was implemented in the vertical microcode layer.

Once IBM i was ported to PowerPC, the vertical microcode was mostly rewritten in C++ and became known as the "Licensed Internal Code" and the PPC instruction set essentially replaced the role of the horizontal microcode.


Incidentally, the term "microcode" for the OS kernel originated with the AS/400's predecessor, the System/38, because, as a legacy of '60s-era lawsuits, it was IBM's policy at the time to separate hardware and software sales and development costs.

Bundling microcode with hardware, on the other hand, was standard practice.

The designers' idea was to build and sell the hardware and software stack as an integrated product, never to implement an operating system or RDBMS "in hardware".

For an explanation of this integrated architecture from one of its original designers, see

https://archive.org/details/insideas4000000solt/page/75/mode...

(registration and check-out required)


I've been waiting for that book to be digitized for years.


This [0] is a pretty good intro to the AS/400 etc.

[0] https://www.scss.tcd.ie/SCSSTreasuresCatalog/hardware/TCD-SC...


> Once IBM i was ported to PowerPC, the vertical microcode was mostly rewritten in C++

I heard once from someone who used to work for IBM, that although the most important parts of the “vertical microcode” were rewritten in C++, a lot of less important bits stayed in PL/MP (the PL/I dialect which compiled to the CISC IMPI native instruction set)-they just built a new PL/MP compiler which spat out POWER machine code instead of IMPI machine code-and so lots of PL/MP code is still there. And then there is also PL/MI, which is used for the higher level OS components which run above the “Licensed Internal Code”-it compiles to MI bytecode-and apparently that’s still around too. And still parts of the OS written in Modula 2. But brand new stuff, they prefer more mainstream languages such as C++


Kind of.

Not sure about the CISC-based AS/400, but current ones have bytecode translation (AOT compilation, IIRC) and run on POWER. In hardware terms, a pSeries and an iSeries are the same, with different microcode customizations loaded into the processors. I think it's even possible to run AIX partitions side by side with IBM i ones, if the processors (or TPM's, not sure) have a valid license.


I think they always did AOT compilation from the AS/400 instruction set to the actual hardware. In the '90s I worked for an external company that did some compiler work on a horizontally-microcoded implementation that didn't get close to shipping. (I don't remember many details, and if I did, I expect they'd still be under NDA.)


This is true; at one point, there was even an instruction that deleted the untranslated code ("program template") to save disk space,

https://bitsavers.org/pdf/ibm/system38/GA21-9331-1_System_38...

This instruction is either not present or not documented in the current Machine Interface[1], but I have no idea when or if it was removed.

[1] https://www.ibm.com/docs/en/i/7.5?topic=interface-machine-in...


> This instruction is either not present or not documented in the current Machine Interface

That’s not actually the current Machine Interface, that’s the legacy one. The current one isn’t documented outside of IBM. IBM still supports the legacy MI, which is translated to the current MI - and high-level language programs compiled to current MI can even embed legacy MI calls as a kind of “in-line assembly” - but all that is converted to the new MI as part of the compilation process


> In hardware terms, a pSeries and an iSeries are the same, with different microcode customizations loaded into the processors

I don’t think the microcode is different. It is true there are a few CPU instructions (memory tagging related) which were added for IBM i, but they are documented and there is nothing technically stopping some other OS from using them.

I thought the difference was that AIX, IBM i and Linux use different firmware. The firmware isn’t CPU microcode, it is just ordinary (albeit privileged) POWER machine code. Or to be more accurate, the POWER firmware has this concept of loadable modules (LIDs), and IBM i needs certain special firmware modules loaded which aren’t required for any other OS. This is why, even though QEMU can run Linux for POWER fine, and even AIX, it can’t boot IBM i-no one outside of IBM really knows what those special firmware modules do or their API, but without them the OS can’t boot. It is unlikely to ever happen without some serious reverse engineering, which would likely upset IBM and cause them to unleash their army of lawyers


> no one outside of IBM really knows what those special firmware modules do or their API

This is a thing that always gets me thinking. How is it possible that the firmware has never been dumped? It's not like there wouldn't be some market for a machine that could emulate an IBM i in jurisdictions where requiring IBM hardware to run the OS is illegal.


> It's not like there wouldn't be some market for a machine that could emulate an IBM i in jurisdictions where requiring IBM hardware to run the OS is illegal.

From a business perspective, in most major markets, too much risk of being sued by IBM. There are some countries in which you don’t have to worry about that - but those countries have few or no IBM i systems, so are likely too small a market to make it worthwhile

I’m sure some hobbyist somewhere will build an IBM i emulator eventually - IBM probably wouldn’t bother suing a hobby project, even if the law was on their side. But it is a pretty niche thing, so the intersection of sufficient skills and sufficient interest is likely to be quite small - that eventually may take a long time. I myself think about it sometimes, but I doubt I’d ever do it - don’t have the time, other things I’d rather work on, don’t have any actual IBM i hardware and I think you’d really need that for reverse engineering


It is absolutely possible to run AIX and IBM i in separate LPARs on the same machine (as of Power 7, at least), as long as you have the appropriate hardware entitlement to run IBM i.


pSeries and iSeries were consolidated down to "IBM Power Systems" back in 2008. I think they may install different firmware onto the systems, but the differences are more related to licensing than anything specific to the hardware.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: