OSDev.org
https://forum.osdev.org/

Should I learn Rust for OSDev?
https://forum.osdev.org/viewtopic.php?f=1&t=31516
Page 1 of 1

Author:  Timmy100 [ Mon Apr 10, 2017 8:26 am ]
Post subject:  Should I learn Rust for OSDev?

Sup guys. Should I learn Rust for OSDev? Is it stable enough? Would it be good enough? Does it work on x86 architecture? Is it supported? Would it be good?

Cheers
Timmy

Author:  iansjack [ Mon Apr 10, 2017 8:37 am ]
Post subject:  Re: Should I learn Rust for OSDev?

It can be fun using languages other than C or assembler for os development, but - personally - I wouldn't recommend it for a beginner.

Author:  Korona [ Mon Apr 10, 2017 9:54 am ]
Post subject:  Re: Should I learn Rust for OSDev?

Rust is a fine language for OS dev however I'd strongly recommend against learning a language and OS dev at the same time. Learn the language first and once you're proficient in it then start learning the OS dev basics. When learning low level stuff you will certainly have to read C and assembly code; it does not help if you have to translate this code into a language you're not familiar with.

Author:  dozniak [ Mon Apr 10, 2017 10:58 am ]
Post subject:  Re: Should I learn Rust for OSDev?

Definitely.

See also https://robigalia.org

Author:  OSwhatever [ Sun Jan 07, 2018 4:07 pm ]
Post subject:  Re: Should I learn Rust for OSDev?

It's been a while since the last post and Rust has matured a little bit more. I would like to ask this question again if anyone here has experience with Rust and OS development.

If you have experience with C/C++ vs Rust pro/cons it would be helpful. Since OS development is a little bit different from application programming how do you consider Rust being a viable alternative instead of C/C++ which today totally dominates this field. Is it good enough to use or is it too enough pain and restrictive?

Do you feel that you have to constantly resort to workarounds in Rust in in order to deal with the "walled garden" ie. making the compiler happy?
Do you have any idea what is happening under the hood. Since lifetimes are handled by the compiler, do you know where objects are actually deallocated. This might not be interesting in application programming but this might matter in OS development.
In OS development you usually end up with a range of different allocators for different purposes. Does Rust handle this easily? For example custom allocators are easy in C++ with placement new.
You constantl

Author:  isaacwoods [ Mon Jan 08, 2018 10:19 am ]
Post subject:  Re: Should I learn Rust for OSDev?

I've been writing an OS in Rust (in conjunction with learning Rust, HOWEVER I already had experience with OS dev so the basic stuff wasn't difficult, and I could afford to concentrate on the language), and it's personally been quite pleasant. It's very different to writing an OS in C and a lot does feel "hidden", but as compiler development is my day-job I'm fairly aquainted with x86 assembly so figuring out what stuff is actually doing hasn't been that bad.

Quote:
In OS development you usually end up with a range of different allocators for different purposes. Does Rust handle this easily?

This was a PITA before RFC 1974 but is now actually quite pleasant, although I think the actual allocator can only be changed on the crate-level.

Author:  Roman [ Mon Jan 08, 2018 11:19 am ]
Post subject:  Re: Should I learn Rust for OSDev?

> Since lifetimes are handled by the compiler, do you know where objects are actually deallocated?

Yes, with Rust you're in full control of where objects are allocated. Rust is pretty similar to C++ in this case. The difference is in that Rust's compiler prevents memory corruption by tracking lifetimes.

> In OS development you usually end up with a range of different allocators for different purposes. Does Rust handle this easily? For example custom allocators are easy in C++ with placement new.

The standard library support for custom allocators is not yet stable. However, nothing prevents you from implementing your own containers that would support custom allocators.

Page 1 of 1 All times are UTC - 6 hours
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/