OSDev.org

The Place to Start for Operating System Developers
It is currently Fri Feb 23, 2018 12:29 am

All times are UTC - 6 hours




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: Should I learn Rust for OSDev?
PostPosted: Mon Apr 10, 2017 8:26 am 
Offline

Joined: Sun Apr 09, 2017 12:58 pm
Posts: 13
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


Top
 Profile  
 
 Post subject: Re: Should I learn Rust for OSDev?
PostPosted: Mon Apr 10, 2017 8:37 am 
Offline
Member
Member
User avatar

Joined: Sat Mar 31, 2012 3:07 am
Posts: 3050
Location: Chichester, UK
It can be fun using languages other than C or assembler for os development, but - personally - I wouldn't recommend it for a beginner.


Top
 Profile  
 
 Post subject: Re: Should I learn Rust for OSDev?
PostPosted: Mon Apr 10, 2017 9:54 am 
Offline
Member
Member

Joined: Thu May 17, 2007 1:27 pm
Posts: 445
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.


Top
 Profile  
 
 Post subject: Re: Should I learn Rust for OSDev?
PostPosted: Mon Apr 10, 2017 10:58 am 
Offline
Member
Member
User avatar

Joined: Thu Jul 12, 2012 7:29 am
Posts: 718
Location: Tallinn, Estonia
Definitely.

See also https://robigalia.org

_________________
Learn to read.


Top
 Profile  
 
 Post subject: Re: Should I learn Rust for OSDev?
PostPosted: Sun Jan 07, 2018 4:07 pm 
Offline
Member
Member

Joined: Mon Jul 05, 2010 4:15 pm
Posts: 507
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


Top
 Profile  
 
 Post subject: Re: Should I learn Rust for OSDev?
PostPosted: Mon Jan 08, 2018 10:19 am 
Offline
Member
Member

Joined: Sun Sep 06, 2015 5:40 am
Posts: 37
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.

_________________
OS on Github


Top
 Profile  
 
 Post subject: Re: Should I learn Rust for OSDev?
PostPosted: Mon Jan 08, 2018 11:19 am 
Offline
Member
Member
User avatar

Joined: Thu Mar 27, 2014 3:57 am
Posts: 567
Location: Moscow, Russia
> 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.

_________________
"If you don't fail at least 90 percent of the time, you're not aiming high enough."
- Alan Kay


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours


Who is online

Users browsing this forum: Goldfish64, Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group