[HN Gopher] Write Your Own Virtual Machine (2022)
___________________________________________________________________
Write Your Own Virtual Machine (2022)
Author : sebg
Score : 86 points
Date : 2024-12-26 19:30 UTC (3 hours ago)
(HTM) web link (www.jmeiners.com)
(TXT) w3m dump (www.jmeiners.com)
| saithound wrote:
| Alas, educational architectures like the Brookshear Machine and
| Little Computer look nothing like real ones, making them worse
| than useless: in my experience students who take courses using
| these often end up with a more distorted understanding of
| computers than those who take no classes at all.
|
| Most people who want to learn a bit about how their machines work
| would be better served by taking an operating systems course.
| Same goes here: if you only have time for a short tutorial, I
| recommend "Writing my own bootloader" instead. [1]
|
| (This is not meant to say that the Write your own VM tutorial is
| a bad tutorial; only that, in my experience, most people who'd do
| it would be best served by a different subject)
|
| [1] https://dev.to/frosnerd/writing-my-own-boot-loader-3mld
| markus_zhang wrote:
| I just did the LC-3 one and look forward to learning a bit
| about dynamic recompilation using LC-3 as an (inappropriate)
| target machine in the current project.
|
| Can you please elaborate why it is bad to use LC-3 for studying
| computer architecture? I do understand it is completely
| different from real hardware, and too simplified. But from the
| perspective of writing CPU emulators, is it bad for me?
| UniverseHacker wrote:
| As a teenager I took an intro CS class at a community college,
| and the instructor had us design a simple cpu instruction set,
| and write our own VM and assembler that worked and let me write
| and run assembly programs. It was shockingly easy, and it was
| amazing how much is demystified computers for me.
|
| I feel like one could learn every level of computing this way-
| from designing a real cpu for a FPGA, to writing a simple OS and
| programs that run on it. This stuff is all shockingly simple if
| you just want it to work and don't need all of the extra
| performance and security modern computing needs.
| tralarpa wrote:
| That's what the nand2tetris course does, I think (I only looked
| at the first lessons)
| spit2wind wrote:
| That sounds like a fun class! It sounds very similar to
| https://www.nand2tetris.org/ or Charles Petzold's book "Code".
| markus_zhang wrote:
| I think once you move from early fantasy CPUs to early CPUs in
| production such as 80286, the complexity immediately moves up
| drastically. IIRC it involves at least memory segmentation,
| protected mode (MMU).
| remexre wrote:
| the 80286 has its own problems/inessential complexity
|
| if you look at this from the riscv angle, moving from "u-mode
| only vm that doesn't use paging under the hood" to "u+s-mode
| vm with sv39" isn't an enormous jump in complexity imo
|
| i think i might teach it starting as like, "sv21" (page
| tables aren't nested), then pose real sv39 and the tree
| structure as the solution to making a sparse mapping over
| 512GiB
|
| then moving on to the idea of having a TLB is simple,
| especially if students have already been introduced to
| hashtables
___________________________________________________________________
(page generated 2024-12-26 23:00 UTC)