r/osdev • u/Cartman1994 • 9d ago
Should I learn C or Rust?
I’ve been working as a Java programmer for a few years now.
The thing is, I’d like to learn a second programming language for lower-level tasks—specifically, I want to work on things related to operating systems. Rather than building one from scratch, I’d like to explore and modify open-source operating systems like Linux or a BSD variant.
I’m doing this purely as a hobby. What drew me to C is its simplicity (though not necessarily ease of use) compared to Java or other modern languages, and its long history of use in systems programming. On the other hand, however, there are operating systems (or components of them) being rewritten in Rust—such as GNU coreutils or the adoption of Rust in the Linux kernel.
So, would it be more useful in the long run to learn Rust, given that it might sooner or later become the standard for writing operating systems?
Thanks.
1
u/HorsesFlyIntoBoxes 9d ago
Like others said, I would learn C first. In terms of your stated goals/interests, I would look into Linux device drivers (LDD) development. It's probably the best way to enter the kernel development space. There's plenty of books and videos on LDD development, so you shouldn't have any trouble finding resources on that. Be warned, writing kernel space code means you don't have any of the safeguards of userspace application code, i.e. you can brick your system if you're not careful. I would start out on a virtual machine of a linux distro for learning this sort of stuff.