Hacker News new | ask | show | jobs
by 3rdAccount 2847 days ago
I haven't read it yet, but I think Nand2Tetris was meant to address this.

Petzold's CODE is also really good going from logic gates to microprocessors to assembly language.

I still wish you could buy something like a Pi board that has just an interpreter and compiler on it as well as a textbook and you implement a simple version of a file system, text utilities, task manager...etc.

7 comments

I find myself asking the same things when it comes to the lower-level software side of things. I find this area fascinating as well, but it's all so "invisible" in modern systems.

I graduated from a CS program (BS) a few years ago, and the projects I'm still most proud of existed "lower" in the stack: implementing FAT16, writing compilers/interpreters (I still have my Brainfuck interpreter!), playing around with paging in MULTICS, and the like.

These were all very toy-like (with good reason, a semester is only so long), but since I enjoyed them I've found myself asking things like "I wonder how the process scheduler/virtual memory manager/in OS X is handling [whatever I'm doing at the moment]? What does my stack look like right now? How are all of these threads communicating with each other, what are they saying?"

You can occasionally see this in the console when something is going wrong, but usually not when the system is operating normally. When the OS is handling a heavy load brilliantly, that's kind of when I'm most impressed, and therefore most interested.

(maybe this kind of procedural output would be dreadfully boring or unreadable due to the complexity of a modern system if I actually saw it, I don't actually know of course.)

`perf top` on Linux, and doing a (really) deeeep dive on the perf and BPF APIs, may be of interest.

The possibly-incorrect impression I get of the performance-analysis related areas of the kernel is that they're a bit siloed (in the same way that X11 is siloed, and only a very small group of people look at it), which may render it bit functionally academic. (It's newer code, though, so there's less chance of eccentricity, FWIW.) Isolation does have benefits - with less chaos to keep up with and less bus factor, the code is changing less and the maintainers have more mental bandwidth to post on mailinglists :), so you have more opportunity to get a good understanding of what's going on.

I don't have the same low-level experience you do, but I do share the same interest in wanting to understand "what's really going on" - and I incidentally want to make a Linux system monitor tool that vacuums up as much information that the kernel is willing to make available to it. `htop` and friends surface a very caricatured picture from maybe 1-10% of the data the kernel has to offer at any given moment.

One of the original concepts for the Pi was an Atmel-based system that booted into BASIC.

Unfortunately these days you can have simplicity or you can have a web browser but not both. And without a web browser a computer feels extremely limited.

Yeah, this. The simplicity of early computers came with a cost: they couldn't really do very much. You can recapture the essential parts of that simplicity today by, for example, firing up a Python interpreter, which is just as easy to learn as BASIC and much more capable. You can live inside a Python prompt for a very long time before you really start to hit the limits. (Or, even better IMHO, inside a Lisp prompt :-) But the fact of the matter is that the technology that makes modern web sites possible is complicated, and there is just no way around that.
Re: Nand2tetris

I was going to reference the same thing. Particularly the text Elements of Computing Systems.

https://mitpress.mit.edu/books/elements-computing-systems

Not sure what to make of it[s downloadability], but I found a PDF: https://archive.org/details/TheElementsOfComputingSystems_20...
This seems a nice and open platform to experiment with; strictly speaking not what you are looking for but can be tailored to the task: https://wiki.odroid.com/odroid_go/odroid_go To me it also looks like a great gift for tech oriented kids.

Many Espressif MCU boards come with Lua already installed, and some other boards are supported by eLua. https://github.com/whitecatboard/Lua-RTOS-ESP32 http://www.eluaproject.net/

It might not exactly be the same as operating real hardware, but I have tried to address this by creating a small VM that is simple to use, understand, and modify[1].

[1] https://latenightsnack.io

Idk why would it have to be dedicated hardware that already has an interpreter/compiler on it. You could make your own mini-os. It's relatively simple to make something that boots in qemu, and once you've done...you can do anything!
The point is to grok the entire system: Hardware, OS, compiler, interpreter...etc.

I think building a FORTH would be educational, but I've never seen a tutorial (including JonesForth) that can take you from zero to Forth. Everyone just says it is easy. Maybe it is more or less obvious with more Assembly background?

Okay, here's an oddball answer: https://github.com/servo/skia/blob/master/forth/

Skia used to include a really simple Forth implementation written in C++. According to https://groups.google.com/forum/#!topic/skia-discuss/joAyAl1... it was intended for straightforward/simple scripting, and for some reason promptly got deleted shortly after being brought up.

[In case you haven't noticed yet, the official Skia repo is at /google/; I've linked to /servo/'s obviously-old copy above, but there are more than enough forks and clones for the code to be findable elsewhere too.]

I kind of like this implementation because it's both incredibly context-specific and generalized all at the same time, and it isn't Bare Metal Implementation #79,513. And it's C++, too, although this is not (overly) abused.