Look Ma! My $5 Pi Zero Thinks It is a Mainframe.


OK, it is not the first. But I couldn’t resist to have fun with it anyway. It is driven by personal nostalgia and fascinated by how computer has achieved such impressive price performance improvement over time that I experience myself. Always wondering what if other modern industries such as automobile or aircraft also achieve that same price performance improvement?

My acquaintance with mainframe started in 1984 when I was assigned to work supporting an IBM 3033 system. I remember it had 16MB memory. With the increasing load, soon it was replaced with IBM 3083 model J (uni processor) and later field upgraded to IBM 3081 model K (dyadic processors). 2423ph3081Finally it was replaced with IBM 3090-200 before the data center was closed down due to data center consolidation. The purchase price of 3081-K processor complex at that time was around $4 millions, that excluded DASD’s (disk) and other peripherals. It claimed performance rating of 15 Mips and power consumption of 23 kW that requires separate water cooling system.  The processor complex alone used up 75 sq. meters of raised floor.

I came across with mainframe again in 2009. Actually it was not a real mainframe hardware. It was IBM zPDT (z-Series emulator on Thinkpad laptop) where I installed and tested the zOS and zVM mainframe operating system.  Soon after, I also got to know Hercules: Open Source System/370, ESA/390, and z/Architecture Emulator. The console messages shown when I IPLed (‘boot’) the operating system was reminiscent of the same messages I saw on the green screen inside the glass house many years back. Except that now it runs on Thinkpad T60 with Intel Core Duo 2.16 GHz which costed around $3000 in 2006.

Then Raspberry Pi first generation was released in February 2012 and I ordered the $35 model B in May 2012. At about the same time, I read Andrew Backs’s blog with interest and planned to have fun with it myself when my order arrived. However due to my activities at that time, the plan was put aside and eventually was forgotten until I received my $5 Pi Zero few months ago. Mainframe on $5 Raspberry Pi is more eye-popping than on $35 Raspberry Pi, I think.

Setting up the Pi Zero

To run the VM or MVS mainframe operating system on Raspberry Pi (Pi Zero included), I need Hercules emulator compiled for ARM processor. Hercules version 3.07 package is already available in Raspbian Jessie repositories.  It makes life a lot easier that I don’t have to compile it myself from the Hercules source. I choose to use Raspbian Jessie Lite as the operating system for Pi Zero.

I setup the Pi Zero to run headless that is without monitor and keyboard. Accessing the Pi Zero is performed using SSH from my laptop computer. This means network connection is required between Pi Zero and the other computer. Since Pi Zero does not have LAN port, I add Wifi USB adapter and OTG cable to plug into Pi Zero’s micro USB port. The other addition is only the standard 5V power supply and min. 8GB microSD card for the disk storage.

Once the installation of Raspbian Jessie Lite and its headless setup is completed and I can SSH to it, I need to get the latest Raspbian Jessie update from the repositories:

sudo apt-get update
sudo apt-get upgrade

I then install the Hercules emulator plus two utilities that will be needed later:

sudo apt-get install hercules unzip dos2unix

Installing and running VM/370 on the Hercules

The first mainframe operating system that I install is VM. With Hercules, legally I can only use public domain version of VM which is VM/370. I can not use the current IBM zVM operating system due to license and legal restriction.

Although I can install VM/370 using standard installation procedure with the product tape images, I choose to use Robert O’Hara’s Six Pack which saves me a lot of time. Robert O’Hara’s Six Pack is Hercules virtual disk images of VM/370 and its program products that have been installed on 6 Hercules DASD volumes. So actually what I need to do is no longer an installation but rather a restoration.

mkdir hercules
cd hercules
wget http://www.smrcc.org.uk/members/g4ugm/vm-370/vm370sixpack-1_2.zip
unzip vm370sixpack-1_2.zip


Apparently Robert O’Hara’s Six Pack was built and tested using Windows version of Hercules. The first time I run sixpack.sh script, it failed because of discrepancies between Windows and Linux. So I need to fix it first:

dos2unix sixpack.sh
chmod u+x sixpack.sh
mv disks Disks
mv Disks/shadows Disks/Shadows
mv io IO
mv sixpack.conf SixPack.conf

After fixing it, I successfully run sixpack.sh that starts Hercules and automatically IPL the VM/370 SYSRES too.


Hercules configuration file SixPack.conf defines an integrated console so that Hercules and VM operator are sharing the same console window. VM operator commands need to prefixed with / to differentiate with the Hercules commands.


IBM 3270 Display Terminal

Robert O’Hara’s Six Pack assumes to use the free x3270 terminal emulator and installed in the same computer where Hercules is installed. However I own a better terminal emulator: Vista tn3270, comparable to IBM Personal Communications and yet only cost $30 with lifetime support. Similar with SSH, I install Vista tn3270 in my laptop computer and accessing VM/370 in Pi Zero through network.


Only 2 parameters in the 3270 emulator that I need to specify:

  1. IP address of the Pi Zero
  2. IP port as defined with CNLSPORT keyword in Hercules configuration. In SixPack.conf, it is port 3270.

By the way, there are also 3270 terminal emulators on Android and iOS. One that I have tried is free Mocha TN3270 Lite which surprisingly also available as Chrome browser plug-in. The last time I accessed mainframe many years ago, there was only Windows 3270 emulator on PC and tn3270 on Unix machines.


Installing and running MVS 3.8j on the Hercules

The public domain version of MVS currently available is MVS 3.8J.  Similar to Robert O’Hara’s Six Pack,  I use MVS 3.8j Tur(n)key 4- (“TK4-“) which is a ready to use OS/VS2 MVS 3.8j system built specifically to run under Hercules Emulator. Otherwise I have to spend a lot of time installing MVS from the product tapes, significantly longer and torturous than installing VM from scratch 🙂

mkdir mvs
cd mvs
wget http://wotho.ethz.ch/tk4-/tk4-_v1.00_current.zip
unzip tk4-_v1.00_current.zip

TK4-‘s startup script for linux runs fine and doesn’t need any change. There are 2 startup scripts:

  1. mvs for unattended operation. User doesn’t need to know how to operate the MVS console.
  2. start_herc for manual operation. User has full control over IPL, operations, and shut down through the MVS console.

The following video shows the manual operation, the same messages I saw long long time ago.

Final words

Of course, I’m not comparing Pi Zero with current mainframe. I’m comparing it with 80’s generation of mainframe. The price, physical footprint and power consumption are very obvious. But how about the performance? Well, I don’t want to bother with Mips because comparing two different architecture using Mips is actually quite meaningless. However as shown in the attached videos, for one or two users load, the performance of Pi Zero is surprisingly acceptable.