Live data from Hacker News

Operating System in 1,000 Lines – Intro

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

81–90 of 129 posts

Re: Operating System in 1,000 Lines – Intro

#81
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, used in House with H layer, is to wrap the lowest-level parts which you might do in assembly. Build the GC or whatever, too. Then, everything else is in the higher-level language. These data, the lowest-level portions can be specified, verified, and implemented.

Re: Operating System in 1,000 Lines – Intro

#82
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?

Porting to any platform is trivial after understanding the basics as described in these articles

The author explicitly describes why they chose riscv32

Why would you want the author to use riscv64 instead?

Re: Operating System in 1,000 Lines – Intro

#83
post #78

Earlier quoted context omitted.

Dijkstra famously said that programmers who started with BASIC are "mentally mutilated". But I think this applies a lot more to C and UNIX. Most of them don't seem to understand how anything substantially different could exist in the world of computing - every other language and operating system is seen as either an inferior copy, or as another layer of abstraction building on top of C and UNIX.

> Dijkstra famously said that programmers who started with BASIC are "mentally mutilated" He knew how to make friends.

To be fair, he was talking about classic BASIC which didn't even have user defined procedures but just goto and gosub similar to jumps and calls in assembly language. I remember when I started learning Pascal after BASIC on the Apple II and there was so much to unlearn about programming because how you wrote BASIC was so different from any other high level programming language.

Re: Operating System in 1,000 Lines – Intro

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

Did you post to OSDev?

Re: Operating System in 1,000 Lines – Intro

#86
post #78

Earlier quoted context omitted.

> Dijkstra famously said that programmers who started with BASIC are "mentally mutilated" He knew how to make friends.

To be fair, he was talking about classic BASIC which didn't even have user defined procedures but just goto and gosub similar to jumps and calls in assembly language. I remember when I started learning Pascal after BASIC on the Apple II and there was so much to unlearn about programming because how you wrote BASIC was so different from any other high level programming language.

Sure. Pascal btw. had a pretty "flexible" goto statement, I would say nearly as flexible as BASIC; Apple ][ Pascal was a bit more structured though. In original Pascal, you could use goto to even jump out of a procedure; Apple Pascal could only jump within a procedure, and only if goto was enabled at all, if I remember correctly.

Re: Operating System in 1,000 Lines – Intro

#87
post #86

Earlier quoted context omitted.

To be fair, he was talking about classic BASIC which didn't even have user defined procedures but just goto and gosub similar to jumps and calls in assembly language. I remember when I started learning Pascal after BASIC on the Apple II and there was so much to unlearn about programming because how you wrote BASIC was so different from any other high level programming language.

Sure. Pascal btw. had a pretty "flexible" goto statement, I would say nearly as flexible as BASIC; Apple ][ Pascal was a bit more structured though. In original Pascal, you could use goto to even jump out of a procedure; Apple Pascal could only jump within a procedure, and only if goto was enabled at all, if I remember correctly.

True. And even C has one. I guess you could write "spaghetti code" in Pascal if you really wanted to.

Re: Operating System in 1,000 Lines – Intro

#88

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 called JOS based on Xv6. So if you're looking for some teaching OS in x86, check it out.

Re: Operating System in 1,000 Lines – Intro

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

How does your book compare with the classic "Operating systems design and implementation" by Andrew S. Tanenbaum and Albert S. Woodhull implementing MINIX?

Re: Operating System in 1,000 Lines – Intro

#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?

Post reply on HN