5 ms·
i recommend C to start with because there are more low-level projects you can work on for practice in C than in Rust; the biggest one being kernel hacking. i de
by woodrowbarlow 8y ago
i recommend C to start with because there are more low-level projects you can work on for practice in C than in Rust; the biggest one being kernel hacking. i definitely recommend K&R to get familiar with the language, but it's a small language so that shouldn't take too much time.
i think the best way to get started in low-level programming is to develop in linux on a raspberry pi and hack your own kernel. explore sysfs, ttys, and gpios. implement new syscalls and device drivers. then go bare-metal on the arduino or a PIC16 chip and build an interesting piece of hardware.
i've collected a lot of my favorite low-level programming tutorials and deep-dives on my HN profile page, but if i were to pick just a couple, they would be:
"Write a System Call": https://brennan.io/2016/11/14/kernel-dev-ep3/ https://brennan.io/2016/11/14/kernel-dev-ep3/
"The TTY Demystified": http://www.linusakesson.net/programming/tty/ http://www.linusakesson.net/programming/tty/
And a book, "Linux Device Drivers, 3rd Edition":https://lwn.net/Kernel/LDD3/ https://lwn.net/Kernel/LDD3/ (free!)
protip: as you're getting started with kernel hacking, use kernel 2.6. LDD3 uses 2.6, as do a wealth of other books.
- steveklabnik 8y agoI was slightly confused by your comment; then I realized: when you say "kernel" you mean Linux, specifically. Rust can very much be used to write kernels!
- kbumsik 8y agoIndeed it can be used to write kernels, but there is not much established examples to learn how to write kernels in Rust. Experienced devs can use Rust to write kernels but learners may want to learn it in C then try Rust.
- steveklabnik 8y agoYeah, we’ve got two big projects (one embedded, one desktop) and tons of toys, and multiple tutorials. Still much smaller than C, for sure.
- woodrowbarlow 8y agoyup! sorry for the confusion. i'd also like to add that anybody who starts on a raspberry pi running linux will benefit from bootstrapped development. re-compiling the (linux!) kernel directly on the device is so much easier than setting up a cross-compile toolchain for C. eventually you'll want to have experience with cross compiling, but when you're first getting started it's a painful hurdle to overcome. cross-compiling in rust is actually getting pretty easy, though, so that's cool.