top of page

Back to BASIC!


Nostalgia can be fun! My earliest experience with computers was with a Commodore PET (https://en.wikipedia.org/wiki/Commodore_PET), circa 1980. This was at school, and we didn’t have the fancy models with the built-in cassette tape drive – we had the model which had an EXTERNAL cassette tape drive. (Needless to say, every student went home that day to listen to the squeal of the programs they wrote...)

I spent a minute thinking about how I enjoyed playing Space Invaders on those computers, then realized that someone, somewhere, someone had probably written an emulator for the PET. Sure enough, I found it – linked on this blog post I found: https://81766.com/commodore-pet-emulator/


So, how was it that I started reminiscing about the PET? Well, I wanted to talk about cloud computing (https://www.til-technology.com/post/get-off-of-my-cloud) in more concrete terms, and realized that it’s necessary to clearly define what we mean by the word “computer” in the first place.


Leaving aside the history and focusing on a more modern definition, a computer (https://en.wikipedia.org/wiki/Computer) requires a processor, memory, and some form of input/output to be useful, and that’s pretty much all.


When we turn on a computer, the BIOS (“Binary Input Output System” - https://en.wikipedia.org/wiki/BIOS) begins running a set of pre-defined instructions. The BIOS is generally stored on a chip on the computer’s “mother board” and includes a process for identifying all connected devices on a computer, essentially by “asking” what they are, and then calling the operating system (Windows, Linux, MacOS, etc)


So, when I start up my laptop, the startup process identifies that (for example) there is something plugged into one of the USB ports, and asks what it is. My keyboard then responds with information describing itself.


But (and this is the interesting part) the laptop only “knows” what it is told, which is why it is possible to plug a USB device called a “Rubber Ducky” into a USB port in order to compromise it. The device “pretends” to be a keyboard and injects commands into the computer.

From the computer’s perspective, then, input/output devices are simply data streams, which means that all we really need is processor capacity, memory, storage (in practice, computers are essentially pointless without some form of storage), and some way to manage the input/output device data streams.

Enter the hypervisor!

A hypervisor (https://en.wikipedia.org/wiki/Hypervisor) is a program that pretends to be one or more other computers – this is where we get the concept of a virtual machine. For those who don’t remember a time before computers and the internet, you probably have no problem thinking of computers running other computers, or find the concept of a “virtual machine” (VM) easy to understand, but it’s really quite an abstract concept. (Also, needless to say, I am shamelessly oversimplifying things – virtualization technology is a very broad and growing field. But, like so many other things, the execution is vastly more complex than the basic idea)

A hypervisor is essentially a program which pretends to be an entire computer. In effect, it allocates and reserves some processor capacity, RAM, and storage as a “virtual machine”, then runs the appropriate startup process “inside” that machine.

The hypervisor I generally use is called VirtualBox, developed by Oracle. In it, I can “carve out” capacity from my computer and dedicate it to one or more virtual machines. Then, when I start up each machine, it will start its own BIOS and start asking questions, to which the hypervisor will provide answers.

Here, it’s important to note that the virtual machine is totally separate, so it will need its own operating system when it starts up. (This also means that different operating systems can be installed on different virtual machines)

As a fun example, I’ll create a virtual Raspberry Pi, similar to the one running my Pihole (https://www.til-technology.com/post/have-some-pi). While a Raspberry Pi is generally considered a “minimal” or “bare bones” computer, it’s actually quite powerful – it’s a general-purpose machine, supporting multiple interfaces and holding a respectable amount of processing power, memory, and storage capacity.

I found some instructions at https://pimylifeup.com/raspberry-pi-virtualbox/, but it’s not a particularly complicated process.

When the virtual Raspberry Pi starts up, it starts asking questions about what hardware is available. But, instead of actual hardware responding, Virtual Box responds and tells the operating system what it has been assigned. So, our virtual Raspberry Pi is “told” that it has 2GB of RAM, an 8GB hard drive, a basic monitor, and a basic keyboard and mouse. The major difference is that Virtual Box controls all of these “devices”, so all interaction is through Virtual Box.

So, I now have a second Raspberry Pi. The first is beside my Ubiquiti Dream Machine Pro, and the other exists virtually. When off, it is simply a set of files in a reserved section of my hard drive. When on, Virtual Box reserves 2GB of RAM, uses the 8GB of hard drive capacity previously reserved, provides processing resources, and manages all of the input/output. The key point here is that I need to have enough capacity on my laptop for Virtual Box to use, which limits the number and size of machines I can run. RAM is normally the bottle-neck – if I have 4GB of RAM, I can probably run a 2GB VM, but trying to run a second one would exceed my system’s capacity.

When I start it up the VM, it behaves exactly as a separate physical computer would, and asks for an operating system. I provided an “Optical Drive” containing a copy of the Raspberry Pi operating system (known as “Raspberry Pi Desktop” – it’s a flavour of Linux), so the VM asked if I wanted to install it. Then came a standard install process, including setting preferences, location information, and the other things an operating system asks for.

The only visible difference is that the “monitor” is a window within Virtual Box, and I can do other things while these processes are running. While I typed, the VM was installing the latest updates to the operating system. (Interestingly, even the fact that the monitor is just a window is not a difference I really see, as I connect to my “physical” Raspberry Pi through SSH (a remote connection), so I see it through a window as well. I could plug a keyboard and monitor into it, but it’s far simpler to manage it remotely.


The possibilities really are endless. No one really knows where we’re going, but it’s often useful to go back to basics and understand where we came from.


Cheers!

Comments


bottom of page