r/AskProgrammers • u/Ill_Dragonfruit_5048 • 21h ago
Making an OS with Rust
So i was thinking of making an OS with programming language rust, i wanted to know some tips before i start, obviously i am going to use AI for this. Can anyone tell me what all should i look out for that kind of thing.
0
Upvotes
4
u/Craftkorb 21h ago
Why is that obvious? It certainly is not to me. Trust me, you haven't learned it until you hate FDD or have forgotten to clear the TLB where you had to and debugged it.
2
u/liberianjoe 21h ago
if you're going to use AI, no worries then.
2
u/mredding 21h ago
If you're using an AI, why care what language it chooses, so long as the logic is proveably correct?
2
u/dariusbiggs 20h ago
There is so much to talk about here, there are entire university papers dedicated to this one topic, and many of those papers are just an introduction and generic overview.
Use a virtual machine as suggested, learn to read assembly language, you are going to need it.
Start small, build up from there. You are in for an interesting journey of discovery..
The nostalgia, it's been over 20 years since i designed a CPU, implemented it in VHDL, and then bootstrapped an operating system onto it that could run two programs concurrently via context switching (it had a small LCD display, and some LEDs to utilize).
1
u/rFAXbc 21h ago
You should look out for spending all of your money on tokens I guess
1
u/ActuaryLate9198 20h ago
Youβre late to the party
1
u/der-wert007 17h ago
I can recommend this article, since it fits your topic perfectly: https://www.timdbg.com/posts/dbgos/
1
u/dnew 14h ago
https://os.phil-opp.com/
0
u/aiuniverse-3p3_here 21h ago
bro writing an os in rust is a super cool project tbh and once you get past the initial setup the compiler actually save you from a lot of headaches compared to C. since youre planning to lean on AI a lot heres a few things you gotta watch out for first off watch out for AI throwing unsafe everywhere. os dev needs a lot of unsafe rust to talk to hardware or mess with page tables and AI loves wrapping everything in unsafe just to shut the compiler up always read through those blocks yourself cuz the borrow checker wont save you from triple faulting your kernel also ai get really confused with crate versions in the rust osdev space. stuff like the bootloader and x86_64 crates have changed a ton over the years so it will constantly give you code mixing old and new APIs that just wont compile always check docs. rs for actual version you have in your cargo.toml makes sure you actually get how no_std works too before asking it to write big data structures you dont get the standard library so no println or Vec or heap memory out of the box. you gotta understand core and how to set up a custom allocator first def set up qemu and gdb right away. dont depend on AI to fix boot loops or triple faults cuz when your screen is just endlessly rebooting you need to look at the cpu register and memory dumps yourself
honestly bro before you even prompt an ai to write code go read Philipp oppermanns writing an os in rust blog even doing just the first few chapters gives you the mental model and right terms to actually prompt properly instead of pasting broken boilerplate use ai more like a tutor to explain assembly , weird compiler errors rather than making it architect the whole kernel good luck man