Live data from Hacker News

Operating System in 1,000 Lines – Intro

operating-system-in-1000-lines.vercel.app

31–40 of 129 posts

Re: Operating System in 1,000 Lines – Intro

#31

Very cool! I just started to dvelve into RISC-V, and the book I'm reading (not in English) offers their own emulator[1], which, at a glance, is much simpler than QEMU, and comes with a weird license[2]. I wonder if people actually used it, since it looks like an academic project. Maybe I can also follow this tutorial and test it out. [1] https://github.com/NJU-ProjectN/nemu/tree/master [2] https://github.com/NJU-Proj…

You can follow the MIT course and use QEMU if so wish.

Link to the MIT course?

Re: Operating System in 1,000 Lines – Intro

#32
post #17

A noble idea, but Github is literally littered with hobbyist home-grown Unix-like kernels in C. As an industry are we not supposed to be trying to move away from hoary old unsafe C? Could we not have a hobbyist educational OSes in more of the C replacements? Drew DeVault wrote Bunnix in Hare, in one month. There's the proof of concept. How about tiny toy Unix-likes in Zig, Nim, Crystal, Odin, D, Rust, Circle, Carbon,…

> Yes I know Ada is not a good fit

Why?

> https://en.wikipedia.org/wiki/TUNIS

Interesting; do you know whether the source code is available somewhere?

Re: Operating System in 1,000 Lines – Intro

#34
Very delightful article. Based on my experience in "hobby" OS programming, I would add setting up GDB debugging as early as possible. It was a great help in my projects and an improvement over debugging with the QEMU monitor only.

QEMU contains a built-in GDB server, you'll need a GDB client built for the target architecture (riscv in this case) and connecting to the QEMU GDB server over the network.

https://qemu-project.gitlab.io/qemu/system/gdb.html

Re: Operating System in 1,000 Lines – Intro

#35
This article brilliantly demonstrates the elegance of simplicity in systems design, proving that even complex concepts like operating systems can be demystified with clarity and minimalism. It's a reminder that understanding fundamentals often unlocks deeper innovation. How might this inspire rethinking other "big" systems?

Re: Operating System in 1,000 Lines – Intro

#36
Author here.

I wrote this book so you can spend a boring weekend writing an operating system from scratch. You don’t have to write it in C - you can use your favorite programming language, like Rust or Zig.

I intentionally made it not UNIX-like and kept only the essential parts. Thinking about how the OS differs from Linux or Windows can also be fun. Designing an OS is like creating your own world—you can make it however you like!

BTW, you might notice some paragraphs feel machine-translated because, to some extent, they are. If you have some time to spare, please send me a PR. The content is written in plain Markdown [1].

Hope you enjoy :)

[1] https://github.com/nuta/operating-system-in-1000-lines/tree/...

Re: Operating System in 1,000 Lines – Intro

#37
post #17

A noble idea, but Github is literally littered with hobbyist home-grown Unix-like kernels in C. As an industry are we not supposed to be trying to move away from hoary old unsafe C? Could we not have a hobbyist educational OSes in more of the C replacements? Drew DeVault wrote Bunnix in Hare, in one month. There's the proof of concept. How about tiny toy Unix-likes in Zig, Nim, Crystal, Odin, D, Rust, Circle, Carbon,…

> Yes I know Ada is not a good fit, but there has already been a Unix-like OS entirely implemented in a derivative of Pascal: TUNIS.

Isn't it? There is a very well-developed kernel written in ADA with SPARK and formally verified at that: https://ironclad.nongnu.org

And PASCAL-derived languages were very popular for operating systems in the 80s. To name a few: Apple's LISA OS, DEC's VAXELN, and OBERON. There were others as well that didn't quite make it, like DEC's MICA and Acorn's ARX.

Re: Operating System in 1,000 Lines – Intro

#38
post #6

Very nice, I always enjoy some low-level discussion like this. I found a small typo/editing glitch on the "RISC-V 101 page" [1]: - It's a trending CPU ("Instruction Set Architecture") recent years. It should probably say "ISA" instead of "CPU", and the word "in" is missing from after the parentheses, right? Edit: Markdown, don't format the quote as code. Oops. 1: https://operating-system-in-1000-lines.vercel.app/en/0…

So do I :D

I was wondering that too. I'll update it with other examples (x86 and Arm).

Re: Operating System in 1,000 Lines – Intro

#39
I never counted, but my first professional software project was an operating system (firmware) for an RF switching box. It was written in 8085 ASM, and was probably in the neighborhood of 1,000 lines.

Apples to oranges, though. It was a specialized firmware system. Probably the biggest part was the IEEE-488 communications handler.

Re: Operating System in 1,000 Lines – Intro

#40
post #36

Author here. I wrote this book so you can spend a boring weekend writing an operating system from scratch. You don’t have to write it in C - you can use your favorite programming language, like Rust or Zig. I intentionally made it not UNIX-like and kept only the essential parts. Thinking about how the OS differs from Linux or Windows can also be fun. Designing an OS is like creating your own world—you can make it how…

This is fantastic. Thank you so much for writing this.
Post reply on HN