2 ms·
> if you really want to know "how the computer works". This depends on what the person is really trying to learn. If they are just interested in learning how a
by munificent 8y ago
> if you really want to know "how the computer works".
This depends on what the person is really trying to learn. If they are just interested in learning how a simple CPU does what it does, then, yes, going straight to an assembly language for some old chip from the 80s is a good idea. Writing an emulator is a fun and instructive exercise.
But my impression is that most programmers who want to learn how the computer works want to because they want to be able to write more efficient software. They want to understand how computer performance works. Learning a simple CPU is anti-helpful for that. It leads you to believe wrong things like "all memory access is equally fast".
If you want to learn how to write faster code, C is pretty good because it strips away the constant factor overhead of higher level languages where things like GC, dynamic dispatch, and "everything is a reference" mask hardware-level performance effects.
It lets you control layout in memory, so you can control data cache effects. Without a VM or interpreter overhead, most of the branches the CPU takes will be branches you explicitly write in your code, so you can control things like the branch predictor.