Rust Systems Programming


#1

Since Rust is more of a systems level programming language, why are there not more papers, tutorials and such on system level programming in Rust (I found one), as well as better documentation and tutorials on DPDK, netmap and GRPC in Rust. I am learning rust and am catching on pretty quickly, but definitely need to see more in the way of systems level programming with it in docs. Thanks


#2

There are blogs, papers, github repos, etc where Rust is used to write an OS (a few different ones), databases, browsers (duh :slight_smile:), interface with microcontrollers, network function virtualization (using DPDK, incidentally), containers, userspace filesystem volume management and so on.

What exactly are you looking for?


#3

I’m currently about half way through the book (which I love) and working through exercism.io. Not coming from a systems language myself (I’m web), I would like to know more about systems programming but a cursory look before I really got started with Rust, I too couldn’t find much. But I guess that is because I don’t really know what to look for, or what areas of system’s programming are good starting places for programmers, but ones that haven’t done lower level stuff? :slight_smile:


#4

I am interested in dataplane forwarding and getting stats from the system itself. I know other languages and it is easy to find docs on the libraries and how to use them to get started. DPDK less so than Netmap. When I look at the libraries for netmap and DPDK, there isn’t much on how to use them, no examples or anything, so not sure how core they are to Rust, but as a very performant and stable language, forwarding planes make a lot of sense for Rust. Also GRPC has 2 repos in github, I finally found which one was available in Crates.io (which I assumed is then the adopted lib, but this could be my mistake). Docs are better for GRPC, but still in “under development” state and has not been touched for about 5 months. GRPC is definitely gaining momentum on SDN controllers for programmability and as a method of streaming data off.

I do see that a book on networking in Rust is coming out, so I am pretty hopeful for that. Hope that provided some clarity. I understand that Rust is a growing language, but would like to see more docs from a person that is looking to learn and grow with Rust from other languages. Thanks for the reply.


#5

Have a look at Netbricks - that’s the NFV written in Rust that uses DPDK.


#6

@Jonny7, yeah I am going through the Rust books and also reaching into C for documentation on things like epoll for event processing and watching/reading as much material I can on Rust futures/async::io or MIO. All good stuff. an old 2007 book on Linux system programming has good material on poll, select and epoll but your gonna need to understand C. I was hoping not to have to reach back to C to go into Rust (defeats some of the purpose). System level programming interacting with Linux system interfaces is what I am really trying to accomplish. I really like Rust, great concepts in a language and seems powerful. Just needs more docs with complete examples. Thanks for the exercism.io link, looks cool I’ll have to check that out.


#7

I’ll have another look at that. I looked a while back, but now that I understand Rust better maybe pulling the code apart to see how it works in Rust will help. Admittedly still digging into the deeper concepts of Rust which most of these advanced projects leverage . Thanks


#8

@havok4u/@jonny7, if you guys are interested in systems programming, don’t restrict yourself to Rust - there are several high-quality OSS projects that would fall into the “systems” space that aren’t written in Rust. For example, PostgreSQL is a very high quality (and well-commented) C codebase. Redis is a high-quality C codebase. Nginx is a good codebase to study for web servers. Sqlite is another one. Seastar is a cool C++ networked server framework (which also can use DPDK) - ScyllaDB is the Cassandra replacement written in C++ (by the same guys) using Seastar underneath.

There are Rust based “systems” as well, as I alluded to in my original reply, but none of them are as ubiquitous/well-known as things like Postgres, nginx, and Redis. Rust could use a “household name” project to catapult it into the limelight a bit more, but it’s still young (in comparison) - I suspect that will come in due time.


#9

@vitalyd Agree, but I was trying to get away from having to go back to C and dealing with memory and low level stuff. Takes too much time to program in C and you open yourself up to a lot of memory management and segfault issues. Rust syntax brings it up a notch, but I think it has a bit to go to truely replace C (which is what I was going for) :wink:


#10

You’ll be dealing with memory management and low-level stuff in a Rust-based system as well :slight_smile:. There should be less of it, but it’ll still be there in your critical and performance sensitive components.

Also, C (or C++ for that matter) are just a means to an end here - I’d look at the ideas implemented in those systems (e.g. around custom memory management, concurrency/parallelism, IPC, error handling/reliability) without caring that they’re in C (or C++). You can translate them to Rust at the end of the day.


#11

Point taken. Thanks for the back and forth. Appreciate it.