Live data from Hacker News

Operating System in 1,000 Lines – Intro

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

101–110 of 129 posts

Re: Operating System in 1,000 Lines – Intro

#101
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…

Are you planning to also provide an English translation of your microkernel book? That sounds very interesting...

Right, that would be great.

Re: Operating System in 1,000 Lines – Intro

#102

The article nicely explains how to build a minimalist OS — works great as an intro material. I think understanding basic OS concepts is essential for performance tuning and debugging.

Notice a bunch of downvotes -- Apologies for being unfamiliar with the rules here (I've always been reading HN, but I'm new to commenting). I should've added a lot more details to my previous comment and been more specific. Any other guides would be helpful too. I'll be careful in the future. When I learned OS, I followed MIT 6.828 ( https://pdos.csail.mit.edu/6.828/2017/overview.html ) and implemented a small OS cal…

I suspect you were downvoted because your comment sounded like it was generated by an LLM.

Re: Operating System in 1,000 Lines – Intro

#103
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,…

OS’s written in Ada included MaRTE OS (open source), Intel’s BiiN system, and the Army Secure Operating System (ASOS) (IIRC). The Muen Seperation Kernel (muen.sk) is a secure hypervisor written in SPARK Ada. Ada was designed for low-level programming. It makes sense it does operating systems fairly easily. Parts of them will break its safety features. They can be validated with external tools, though. Another trick,…

Fair point.

I was slightly more getting at it being not a natural fit for a Unix-like OS but I accept your point.

AFAIK, sadly, Intel BiiN is lost to history now. A Register reader wrote in to me to tell me that he was one of the developers.

Re: Operating System in 1,000 Lines – Intro

#105
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…

If you want PRs, I suggest you set up Semantic Linefeeds* sooner, rather than later. Each sentence gets its own line, and it really helps avoid merge conflicts. * https://rhodesmill.org/brandon/2012/one-sentence-per-line/

TIL. It's too late for this book, but I'll try it in the next one.

Re: Operating System in 1,000 Lines – Intro

#106

Earlier quoted context omitted.

OS’s written in Ada included MaRTE OS (open source), Intel’s BiiN system, and the Army Secure Operating System (ASOS) (IIRC). The Muen Seperation Kernel (muen.sk) is a secure hypervisor written in SPARK Ada. Ada was designed for low-level programming. It makes sense it does operating systems fairly easily. Parts of them will break its safety features. They can be validated with external tools, though. Another trick,…

Fair point. I was slightly more getting at it being not a natural fit for a Unix-like OS but I accept your point. AFAIK, sadly, Intel BiiN is lost to history now. A Register reader wrote in to me to tell me that he was one of the developers.

That's cool that you heard from one.

What I really wanted from a developer was the i960. Specifically, the version with the object protections. That might be worth buying today for secure, embedded work. If I found the right person, I'd ask them to open-source, or at least dual-license, the i960. For embedded systems, leave it as a RISC-V alternative or port it to RISC-V.

Re: Operating System in 1,000 Lines – Intro

#107
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…

Are you planning to also provide an English translation of your microkernel book? That sounds very interesting...

Unfortunately not. Maybe I'll write another online book like this in English, after building a more practical microkernel-based OS. It's a very interesting topic indeed :D

Re: Operating System in 1,000 Lines – Intro

#108
post #90
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…

Great resource, thanks for sharing. I thought the written text was very high quality and didn't show many of the usual tells of a non-native writer. Could you share some details of how you used AI tools to help write it?

Copy-and-pasting to ChatGPT. Machine translation (JP to EN) before this LLM era was already high quality, but LLM does a really great job. It does not translate as is, but understands the context, drops unnecessary expressions (important!), and outputs a more natural translation.

That said, LLM is ofc not perfect, especially when the original text (or Japanese itself) is ambiguous. So I've heavily modified the text too. That's why there are some typos :cry:

Re: Operating System in 1,000 Lines – Intro

#109
post #95
post #51

This is on my to do list of things to learn but I also don't know yet the purpose other than it being your own. Maybe security since most of what I work with is on top of the OS eg. programming languages. Maybe for RTOS applications at any rate this and OS Dev good resources.

I find this kind of thing most useful for microcontrollers and real-time embedded systems that don't require full networking. I've used many of these concepts but maybe not all at once on what many would call "bare metal" systems with no OS. Audio gizmos like cheap synths, LED nodes, things you want booting really fast with well-bounded functionality. An OS can get in the way with this kind of system if all you reall…

Interesting. Yeah for me it's like RISCV, at the end of the day if it runs windows/Linux do I care what's underneath. I gotta get there to know why it matters. Other than the challenge of doing it.

Re: Operating System in 1,000 Lines – Intro

#110
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…

Could you port this to riscv64 please?

No it's "left as an exercise to the reader" ;)

But seriously, it's not that hard. Change build options to generate 64-bit ELF, replace all 32-bit-wide parts (e.g. uint32_t, lw/sw instructions), and implement a slightly more complicated page table (e.g. Sv48).

Post reply on HN