DEV Community

Birk Skyum
Birk Skyum

Posted on

Systems Programming Paradigms

Making software that talks to the hardware are known as systems programming. Because applications run on top of a system, like an operating system, the performance, and safety of the system itself are key. This also goes for high-performance applications of course. The two most important metrics are:

  • A low runtime overhead - This is achieved by leaving out garbage collection (see note below), and keeping the standard library small.
  • A high hardware utilization - This is achieved through parallelization.

Garbage Collection (GC): When a variable is assigned, some memory is allocated, and thus we need to figure out when it can be deallocated again. A common approach is tracing, where the GC tries try to figure out when a resource it's no longer reachable. Previously, reference counting was quite common, where the memory was released, when the number of references fell to zero. This convenient process of garbage collection clearly takes resources, and while it's common practice in application development, the systems programmer can rarely afford it.

Only a few programming languages have gained mass adoption in this area because any new language would need to bring major advancements over the current standard in order to become relevant.

1949 - Assembly

The first of these languages is Assembly, which on top of what resembles line-by-line machine code instructions allows for the convenience of constants, macros, labels, and comments. These features made assembly the de facto standard for years.

1972 - C

The C language has an advantage over Assembly by being structured. The structured programming came in the form of better control flow through branching (if/else/or/switch), blocks, and loops (do/while). Other important additions were the lexical variable scopes, recursion, and static types.

1985 - C++

C++ as a superset of C, initially brought classes, the ability to make new types, function overloading, reference variables, try/catch blocks, and more. This allowed for object-oriented programming.

Through time has C++ gained much more functionality and moved way beyond systems programming. In the 2020 edition, C++ brought modules and other long-awaited features, so the momentum is sure to be kept into the foreseeable future.

2010 - Rust

The lack of garbage collection means that memory safety has always been a big concern in systems programming. This is because the developer is tasked to deallocate the memory, which is error-prone, and parallelization only makes matters worse. In fact, a 2019 study by Microsoft (Page 10) showed that ~70% of all common vulnerabilities and exposures (CVEs) every year from 2006 to 2018 were rooted in memory safety.

Rust resolves this entire category of issues through a concept called borrow checking. This allows the compiler to guarantee that only memory-safe code is compiled successfully, even with parallelization. Sometimes the compiler blocks code that you know is safe, but Rust can guarantee it, and in this case, there is an "unsafe" flag to disable the check.

Rust has gained quite a reputation lately, as the most loved language for 6 consecutive years in StackOverflow Developer Survey (2016-2021). There's also no lack of backing for the project, which in 2021 became clear when Microsoft, Google, Amazon, Mozilla, Facebook, and Huawei in a collaborative effort decided to form the Rust Foundation.


It's great to have competition because it accelerates innovation, and now time will tell if Rust will be bringing a new memory-safe paradigm, or if C++ can become safer and fend off the competition. Either way, it will be exciting to see what’s next to this story.

Top comments (0)