4 ms·
I don't even know where to _begin_ writing an operating system. If i wanted to learn just so i have a concept of what an os does, what would you recommend? I'
by Gunax 1y ago
I don't even know where to _begin_ writing an operating system.
If i wanted to learn just so i have a concept of what an os does, what would you recommend?
I'm not trying to write operating systems per se. I'm trying to become a better developer by understanding operating systems.
- kragen 1y agoTanenbaum's textbook is highly readable, comprehensive (surveys every major known solution to each major prpblem), and mostly correct. xv6 may be a smaller, more old-fashioned, and more practical approach. RISC-V makes the usually hairy and convoluted issues of paging and virtual memory seem simple. QEMU's GDB server, OpenOCD, JTAG, and SWD can greatly reduce the amount of time you waste wondering why things won't boot. Sigrok/Pulseview may greatly speed up your device driver debugging. But I haven't written an operating system beyond some simple cooperative task-switching code, so take this with a grain of salt.
- remexre 1y agoFunny question since you bring up JTAG and RISC-V -- do you have a cheapish RISC-V device you'd recommend that actually exposes its JTAG? The Milk-V Duo S, Milk-V Jupiter, and Pine64 Oz64 all seem not to expose one; IIRC, the Jupiter even wires TDO as an input (on the other side of a logic level shifter)...
- kragen 1y agoThat doesn't seem off-topic at all to me! I don't know what to recommend there. I have no relevant experience, because all my RISC-V hardware leaves unimplemented the privileged ISA, which is the part that RISC-V makes so much simpler. The unprivileged ISA is okay, but it's nothing to write home about, unless you want to implement a CPU instead of an OS.
- userbinator 1y agoStart with a simple program loader and file system, like DOS.
- a96 1y agoI suggest the opposite. Never DOS, particularly never MS-DOS and never x86 or anything in that family. They are an aboslute horror show of pointless legacy problems on a horrifying obsolete platform. Practically everything you'd learn is useless and ugly. Start with an RTOS on a microcontroller. You'll see what the difference is between a program or a library and a system that does context switching and multitasking. That's the critical jump and a very short one. Easy diversion to timers and interrupts and communication, serial ports, buses and buffers and real-time constraints. Plus, the real-world applications (and even job opportunities) are endless.
- userbinator 1y agoIf you have that sort of disrespect for computing history, you will only destroy and reinvent things badly.
- lock1 1y agoIf you want to practice, try: https://littleosbook.github.io/ https://littleosbook.github.io/ I am an occasional uni TA that teaches OS and I use littleosbook as the main reference for my own project guidebook. It's a decent warm-up project for undergraduates, giving them a first-hand experience programming in a freestanding x86 32-bit environment.
- AbbeFaria 1y agoGo do the xv6 labs from the MIT 6.828 course, like yesterday. Leave all textbooks aside, even though there are quite a few good ones, forget all GitHub tutorials that have patchy support, blogs that promise you pie in the sky. The good folks at MIT were gracious enough to make it available for free, free as in free beer. I did this course over ~3 months and learnt immeasurably more than reading any blog, tutorials or textbook. There’s broad coverage of topics like virtual memory, trap processing, how device drivers work (high-level) etc that are core to any modern OS. Most of all, you get feedback about your implementations in the form of tests which can help guide you if you have a working or effective solution. 10/10 highly recommended.