PFFD — Start Building a Virtual Machine

One of the areas in computing that I have been wanting to explore more in depth are CPUs (Central Processing Units) and GPUs (Graphics Processing Units). I did study computer engineering in college. Computer Architecture was my absolute favorite class in all of grad school. But I have forgotten almost all of it. So, I want to get started by diving deep into CPUs and GPUs. I will start with CPUs first as I have some previous experience in the area.

CPUs are the brains of the computer. At a very high level, a CPU takes in the instructions provided to it and runs them. The set of instructions supported a CPU is called its Instruction Set Architecture (ISA). The CPU is also be able to manipulate data. Most of the data is stored externally from the CPU. You might have heard of hard disks or random access memory. (I am hand waving away pesky things called CPU caches. But we will go deep into this in a future post) These are the common spots in which data is stored. But CPUs do not know about them. Instead, CPUs have storage spots called registers where it reads from and writes data to. In order for the CPU to know about some data, we have to move that data from the external memory and place it into the registers. The combination of the CPU (its ISA, registers, etc) and external memory is what we refer to as a computer/machine.

For my first project, I want to build a Virtual Machine. Building this virtual machine will allow me to explore different CPUs and ISAs.

Time to get stared!

I have created and merged a PR that contains the shell of the virtual machine —  https://github.com/adhithyan15/programming-for-fun/pull/1. This will serve as the building block for our future virtual machine.

P.S – One of the programming languages that I feel very comfortable in is Ruby. So, I am going to start writing this virtual machine in Ruby.

Leave a comment