Skip to main content

My Raspberry Pi Thinks It's a Mainframe!

As the Raspberry Pi (896-8660) started to ship the Sinclair ZX Spectrum turned 30 years old, and comparisons were being made between the two and their role in providing access to affordable computer hardware. Given the phenomenal advances in computing since the birth of the ZX Spectrum, I thought it might be fun to compare the Raspberry Pi with a computer that was closer to the state of the art at around that time, and to see if the Raspberry Pi could fill its shoes...

Mainframe_CPU_Detail_4d704472454b9a39582d6c59818528ae3a2c566e.jpg

Introduced not long after the ZX Spectrum, the IBM 4381 processor was the workhorse of mainframe computer installations that could fill a data centre and support many thousands of users. Managing to do this with what may now seem to us like trivial resources:

  • 2-2.7 MIPS CPU

  • Optional maths co-processor

  • 4-32MB RAM

  • Up to 4x I/O channels running at 3MB/second

Even when compared with the pocked-sized Raspberry Pi, which manages to pack:

  • 965 MIPS CPU

  • FPU + 24GFLOP GPU

  • 256MB RAM

  • 60MB/second I/O (USB2)

Actually, this comparison is more than a little unfair, in that metrics such as MIPS ratings are not that useful when comparing dissimilar architectures. And mainframes are pretty special, with things like “assist” processors that free up the main CPU from having to do certain tasks, and terminals that manage presentation and enable efficient use of mainframe resources. But still, this does serve as a powerful indication of fundamental technological progress that has been made.

Could a Raspberry Pi replace the IBM 4381? Well, it turns out that just as it's possible to use a Pi to emulate a ZX Spectrum, one can be used to emulate a somewhat larger mainframe computer. This has been made possible by a piece of open source software called Hercules, and next we'll cover the experience of running this under Debian Linux on a Raspberry Pi.

First we install the hercules package from the Debian repository, and then create a configuration file which tells it to emulate a model 4381 machine with 16MB RAM and terminals and storage etc. attached. Hercules is then executed from the command line, and we run up an IBM 3270 terminal emulator from another machine on the network, providing it with the IP address of our Raspberry Pi and the port number specified in the Hercules configuration.

On connecting, Hercules prints out a few details to the remote 3270 screen.

3270_006cdceceef2270e4704d333a2efec962fa8469b.jpg

Then if we go to back to the Raspberry Pi (connected to over its UART via a PC running minicom) we see that Hercules reports that a terminal has attached.

herc-booted_9cb3a29474a729dd13d8cd3967a043004ae0a97e.jpg

A computer without software wouldn't be much use, and so Hercules was configured with virtual disk drives containing a very old public domain release of a mainframe operating system that still finds much use today, VM. As the name suggests this provides virtual machines (mainframes!), in which it's possible to run applications, some other mainframe operating system, or should you wish to utterly confuse yourself, another copy of VM with a third copy of VM running inside that.

Shortly after our 3270 terminal attaches to Hercules the VM system starts to boot, or “IPL” to use the IBM parlance. With VM reporting that it has 16MB of memory available, of which 460K is being used for the operating system nucleus (kernel).

vm-booting_456777de5040fa04370fbd95766f7c7c1533cc43.jpg

After a short period of time start-up completes and VM provides the status of attached card punches and printers. Which are, of course, virtual and represented by files under the Linux filesystem.

vm-booted_251c28081b07332c90c2584454976f525bc1f4b4.jpg

If we go back to the Hercules instance running on the Raspberry Pi we can hit ESC to toggle the view to a screen which displays a virtual hardware console. With register contents displayed in the left-hand side of the screen, and details of the peripherals on the right-hand side.

title

Now that the system has completed start-up we can go to our 3270 terminal and log on to VM as an administrator, by using the command “logon maint”. After entering the password for the maint account we can then use “q dasd” to show details of the configured storage (DASD = direct access storage device).

vm-q-dasd_dadd874d78b9e7e483573cae13a84e9f971846dd.jpg

Finally, when we are finished we tell VM to shut down before exiting the Hercules emulator.

vm-shutdown_1d854b68f9bacc5930093de1be476a194429864e.jpg

So, a Raspberry Pi can be used to emulate a mainframe which would have filled a large computer room, and to run the same software which it would have run. Of course, the only reason you would do this is for fun, learning or perhaps as part of computer conservation efforts, e.g. in providing continued access to old computer software and/or data. A modern mainframe would massively outperform a Raspberry Pi and offer many benefits beyond simple processing power.

Having configured a mainframe on a Raspberry Pi, it was time to try out a Raspberry Pi on a mainframe! The image below shows the Pi sat on top (centre) of the CPU from an IBM 4381, which was recovered from a scrapped processor cabinet many years ago.

Mainframe_CPU_52121b8eafb0866ef2e6a1914e492224b4693e36.jpg

The 21 blue modules are ZIF socketed ceramic IC packages with heatsinks, and apparently each contain a 6x6 array of chips that each dissipate up to 3.6W! The six brown multi-way connectors to the left carry signal lines and the busbars up either side supply the required power of up to ~2.7kW. The whole assembly is analogous to the processor chip in a modern PC and was located inside a cabinet roughly the size of a wardrobe, along with a PSU, powerful fan supplying forced air cooling and support electronics. The 4381 cabinet being just one of many in a mainframe installation, with others containing things such as disk drives and communications controllers.

Andrew Back

Open source (hardware and software!) advocate, Treasurer and Director of the Free and Open Source Silicon Foundation, organiser of Wuthering Bytes technology festival and founder of the Open Source Hardware User Group.
DesignSpark Electrical Logolinkedin