Sharp as a Buffon needle

I rarely throw anything out (which is, of course, precisely why — these days — I can rarely find anything). A while ago I mentioned my pleasure at having BBC BASIC on BlackBeast. (That would have been the six-core BlackBeast Mk I running Windows 7.) Here's a scan of one of my earliest BASIC programs1 written to run on the decsystem10 at Hatfield Polytechnic in 1972. Critics may notice it already contains (line 100) that which it is attempting to simulate the generation of.

Buffon needle

dec's operating system used simple hard-wired round-robin scheduling to give the (maximum) 63 terminal users one 64th of a second per second each. Now, the larger the loop size in my little simulation, the closer the approach to a value of "pie". But the longer the program running time2 — during which I couldn't do anything else (like, for random example, my engineering course work calculations) at my teletypewriter terminal. No problemo. Brief scrutiny of the dec reference manuals in the campus bookshop (before they were removed!) showed me I could "detach" from my current process but leave it running while I logged back in and did whatever else I needed to.

You can probably see where this is going.

Having set my harmless little program running with a loop size of one million, I detached from it, logged in afresh, and started keying in some more work-related material. About five minutes went by before an irate systems chap stormed into the console room to suggest, neither calmly nor quietly, that whoever owned job number such-and-such should take it off his system right now! as it was absorbing every spare CPU cycle. Looking back, I suppose it was quite amusing how easily a simple end-user could cripple such a "big" system in those innocent days :-)

Also amusing: when I flew out of the aircraft industry to join ICL in February 1974 I quickly discovered that the humble teletype was considered an "exotic peripheral". It was the only sort I'd dealt with at that point. And in 1996, when I upgraded my 64MB Acorn RISC-PC700 with a then-new 200MHz StrongARM processor, I found I could run my program entirely in the processor's cache and produce an equally approximate result hundreds of times more quickly.


1  It got me into a bit of trouble with the chaps who ran that mainframe (who obviously regarded their controversially-imported foreign toy as far too valuable to allow students to mess with).
2  With a loop size of 800,000 for example, the run time was 1022.82 seconds and the estimate was 3.14176 — not too shabby.