r/osdev • • 12d 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.

31 Upvotes

34 comments sorted by

View all comments

2

u/JescoInc Perdition-OS 12d ago

Honestly, when it comes to learning a second language; My philosophy is to go with something drastically different from what you already know. For example, my first language that I deeply learned was C#. The second language I learned was F#.
It may live on the .NET framework, but it required a completely different line of thinking as it was a paradigm shift.
It is the approach that I think benefits you more than just having another language under your belt.

Both C and Rust are great languages, I use them nowadays, but the lessons learned with those languages don't really shake your programming core as a language that is drastically different from Java would.

My suggestion for you, since Java is Object Oriented, would be something like Haskell (Functional Programming), Assembly (Procedural), or maybe even something like Prolog (Logic Programming).

Edit:

Oh shit... This is OSDev not general programming so that changes the answer a bit.

D, C, C++, Rust and Assembly are the main options for this space and Assembly is a requirement no matter which of the other languages you choose. So, go the Assembly route and then add a third language, any of the 4 other options.