Blog posts en open-source projecten
- Embedded software engineer
Folkert is an expert in systems programming. He has made major contributions to the creation of the (soon-to-be) friendly, fast, functional language called
Roc - in fact, he has so far written about half of the code; He co-teaches (and co-creates) the university course
Rust 101; And he is working on the Rust implementation of the Network Time Protocol,
Difficult problems don´t rattle him. In fact, we can rely on Folkert to face them head-on and produce solid implementations in remarkably little time.
In his spare time, Folkert often continues to work on languages (natural or other) and he likes to cook or spend time in the garden.
ntpd-rs: NTP for the modern era (video)
While working on the Roc compiler, we regularly dive deep on computer science topics. A recurring theme is speed, both the runtime performance of the code that we generate, as well as the performance of our compiler itself.
One extremely useful technique that we have been playing with is data-oriented design: the idea that the actual data you have should guide how code is structured.
Sorting with SIMD
Google recently published a blog article and paper introducing their SIMD-accelerated sorting algorithm.
SIMD stands for single instruction, multiple data. A single instruction is used to apply the same operation to multiple pieces of data. The prototypical example is addition, where one instruction can do e.g. 4 32-bit additions. A single SIMD addition should be roughly 4 times faster than performing 4 individual additions.
This kind of instruction-level parallelism has many applications in areas with a lot of number crunching, e.g. machine learning, physics simulations, and game engines. But how can this be used for sorting? Sorting does not involve arithmetic, and the whole idea of sorting is that each element moves to its unique correct place in the output. In other words, we don't want to perform the same work for each element, so at first sight it's hard to see where SIMD can help.
To understand the basic concepts, I played around with the ideas from the paper Fast Quicksort Implementation Using AVX Instructions by Shay Gueron and Vlad Krasnov. They provide an implementation in (surprisingly readable) assembly on their github. Let's see how we can make SIMD sort.
ntpd-rs is an implementation of NTP completely written in Rust, with a focus on exposing a minimal attack surface. In this blog post the process of implementing a new open-source version of the Network Time Protocol is explained.
The project originates from ISRG's Prossimo, as part of their mission to achieve memory safety for the Internet's most critical infrastructure. Prossimo funded the initial development of the NTP client and server, and NTS support. The NTP initiative page on Prossimo's website tells the story.
ntpd-rs is part of Project Pendulum.