vanheusden.com

An operating system-agnostic load indicator for the PDP-11/70

Background

Operating systems usually have an indication for how busy they are. Because sometimes the CPU has to wait for I/O or maybe no process has something to do, this is not a constant 100%.

For modern operating systems there are nice GUI applications that show this load in a graph.

graph drawn by windows showing its load   terminal showing linux load

In my spare time I currently mostly tinker with the PDP-11/70. On a small RAM system like the PDP-11 drawing a GUI is problematic due to resource limitations. So I started to wonder if I could then maybe measure this from outside the operating system, making it OS agnostic even. As I'm working on a PDP-11/70 emulator, I've got a playground for trying a few things.

What I tried

The PDP-11/70 has a 'WAIT' instruction. This instruction WAIT makes the CPU wait for an interrupt to come in. During that time the CPU does nothing, just sits idle, waiting. I could maybe measure how much time was spend during the execution of that instruction. That quickly became tricky with measuring time taking a lot of time by itself and situations where for example the WAIT started just before the second spanning across the second-boundary, so I dropped that idea.

Then I realised that the 11/70 has the "KW11-L" subsystem. The KW11-L is a systemboard which produces 50 times per seond (or 60, depending on the country you're in) an interrupt based on the zero-crossing on an AC power supply.

photo from gunkies.org
kw11-l board

What if I just count the number of instructions executed during these 50 Hz intervals? This was easy to test: an instruction-counter in the cpu-emulation and a printf-command in the interrupt-emulation code showed that indeed (as expected) the number of instructions executed varies wildly, especially in a multi-user operating system like BSD 2.11.

Visualization

My PDP emulator runs mostly on microprocessors (also on desktops and laptops but that is not relevant for this). These microprocessors like the Teensy 4.1 and the ESP32 can produce "PWM signals". With some electronics that make up a low-pass filter, these PWM signals can be converted into a voltage. So with a capacitor, a resistor you can let a 3.3 V gauge show a certain value.

 

What I now do is count the number of instructions executed in the interval, normalize it into an 8-bit value and using analogWrite I let the gauge show an indication of how busy the system was in the interval that just ended.

media




For contact info, see this page.


bad crawlers