Live data from Hacker News

Ask HN: How to learn proper systems programming?

news.ycombinator.com

51–60 of 97 posts

Re: Ask HN: How to learn proper systems programming?

#51
post #40
post #33

Back when started coding, system programming were books like these ones, https://www.atariarchives.org https://archive.org/details/pcinternsystempr0000tisc Granted they are probably too old, but the concepts of what is actually systems programming is there, you can then get hold of an Arduino or Rasperry PI like device and do your own little OS or bare metal game, https://www.cl.cam.ac.uk/projects/raspberrypi/tutoria…

KeithS from https://www.assemblytutorial.com/ https://www.youtube.com/c/ChibiAkumas/ does introductions to assembly programming on nearly every old microcomputer platform you can think of.

That is cool!

Re: Ask HN: How to learn proper systems programming?

#52
Another interesting rabbit hole to explore is the compiler. Back in the day I wrote a toy compiler for a college course and used this text book: "Compilers: Principles, Techniques, and Tools". a.ka. "The Dragon book", but I would look at some of the other books here like "Modern Operating Systems" before this.

Re: Ask HN: How to learn proper systems programming?

#53
I took the Computer Security and Internet Security courses from Professor Du at Syracuse University, years ago. Both courses had end projects that required extending a kernel and userspace to implement security functionality.

At that time, we had the option to work with MINIX. Here are the MINIX Role-based Access Control and Firewall Labs:

https://web.ecs.syr.edu/~wedu/seed/Labs_12.04/System/RBAC_Ca... https://web.ecs.syr.edu/~wedu/seed/Labs_12.04/Networking/Fir...

Professor Du's materials are also packaged for self-learners and other teachers to use, as the open source SEED project. A few of the current SEED projects are implementation-exercises similar to the above two labs.

https://seedsecuritylabs.org/

I highly recommend the above resources.

Re: Ask HN: How to learn proper systems programming?

#54
I learnt this the hard way. Textbooks do not do a good job of teaching how real world code looks like. Best option is to read open source code. Start with sqlite or openbsd userland tools. Code is very clean and obsd style is very very easy to understand, esp the clever use of C macros. Sort github by the most popular rust, c++,go or D code and be on your merry way...

Re: Ask HN: How to learn proper systems programming?

#55
post #34

Follow-up question: how do I learn systems programming on Windows ? I know it’s pretty easy to just set up a Linux VM or use WSL2, and I’m prepared to do that if I must, but it would be even easier if I could work in the same Windows environment I normally use. However, from what I’ve seen, practically all guides to systems programming seem to start off by assuming you’re using Linux. (And by the way, thanks OP for a…

IMHO getting into the world of malware analysis and reverse engineering could be profitable for both your brain and your pocket. And they force you to go deep from day one. I do not have the expertise to work on either field but this is something in the plan. The good part is that most malwares are targeting Windows so you get a lot of samples.

This is good advice.

Also, Windows is an excellent way to learn systems programming because the documentation and tooling is so good and things hardly ever change.

There is a wealth of documentation on MSDN for writing device drivers and such. And great tools for remote debugging so you can set up a VM in hyper-v and step through the code from the host system.

Do make sure if you're analyzing malware you do it in a VM on a machine you don't care about having to wipe, and isolate it from the rest of your network.

Re: Ask HN: How to learn proper systems programming?

#57
The first book in particular is brilliant - I recommend reading it cover to cover.

I would suggest some kind of performance oriented project, where syscalls costs and concurrency issues matter? This will give you a 'feel' for what's going on, and why what's available is available.

Finally, I suggest reading lwn, which will give you a very good idea of what's happening in the kernel:

http://lwn.net

Re: Ask HN: How to learn proper systems programming?

#58

Years ago I modified the Postgresql source code (8.xx). It's something I was terrified of doing. But once I got in there and started poking around, I realized it was just ordinary plain-vanilla C code. Not C++. Just C code. With my local copy, I started to hack pg_dump to do something special that we wanted at the time. Even after 30 years of coding, I'm not that especially good of a programmer. But I ended up gettin…

I want to add to this. People might think they lack opportunities for this exercise because they don't have special requirements out of the open source packages they use. But realize that breaking a piece of code in a controlled manner also needs roughly the same level of understanding as adding a feature.

It could be as simple as a `sleep` in the right circumstances. Maybe your resulting patch is a boring handful like:

    bool cond1 = ...;
    bool cond2 = ...;
    if (cond1 || cond2) {
      sleep(1000);
    }
but you need to read and develop understanding of the code to define the conditions in terms of the program's state. And you also need the same understanding to know where exactly in the code to introduce this snippet. Not to mention compiling it; even with Makefiles, lower-level languages could still be tricky to build.

How this can be useful: Long time ago, we were observing odd behavior from Redis under extremely high load. Of course it did not replicate consistently and when it did, it lasted too short for us to properly observe and make hypotheses. So I had the brilliant idea of installing a custom Redis binary in our test environment that tweaked the odds so that the behavior happened almost consistently, no need to thrash the server. I had to read through Redis source code to make it happen (and added a hell lot of logs too). Plus in the end, it's not quite compiling Linux but, boy, I did compile Redis from scratch!

Re: Ask HN: How to learn proper systems programming?

#59
Like any other area you want to learn you should go in with a goal that gives you some intrinsic motivation. At this point in history, Systems Programming is too broad for one person to ingest. Do you want to work on networking? Filesystems? Databases? If you want to get into networking for example (my area) I would recommend you just skip ahead and try to learn ebpf (which is clearly taking over, as Windows has now implemented it). If your interests are other, really do some up front research into what you should be learning.

Re: Ask HN: How to learn proper systems programming?

#60
post #37
post #34

Follow-up question: how do I learn systems programming on Windows ? I know it’s pretty easy to just set up a Linux VM or use WSL2, and I’m prepared to do that if I must, but it would be even easier if I could work in the same Windows environment I normally use. However, from what I’ve seen, practically all guides to systems programming seem to start off by assuming you’re using Linux. (And by the way, thanks OP for a…

The best start would probably be both parts of Windows Internals: https://www.amazon.com/Windows-Internals-Part-architecture-m... https://www.amazon.com/Windows-Internals-Part-Developer-Refe... These aren't about programming per se, but if you want to do systems programming it helps to have a detailed understanding of the system. :) After that, specific reading probably depends on the exact task you want to perform,…

To add on, the windows internals books have exercises with the sysinternals tools. If sitting down and plowing through a doorstop of a book isn't your cup of tea, try picking a chapter or two which sound interesting, skimming them, and doing the exercises.
Post reply on HN