Thoughts and Opinions on Coding and Tech
On more occasions than I’d be comfortable with I’ve heard that software should be modular. To be fair: I am one of the advocates of the claim that modularity is worth striving for. But what is actually meant by that? There is no universally agreed upon definition for modularity.
If you’ve had training in math, statistics, computer science or any other number crunching field you already know linear regression. Linear regression is just one tool that employs a wonderful technique: least squares
In all honesty the internet does not really say that much about
epoll. It’s mostly a post from 2017 called epoll is fundamentally broken that annoys me. The blog post states that “if you can you should avoid using
epollfor load balancing across threads”. I strongly disagree with that statement and with the overall methodology of the post.
Maybe you are already familiar with coroutines and cooperative multitasking as it exists in python. The upcoming C++20 extensions to C++ will include coroutines with which something equivalent can be implemented quite easily. In my recreational C++ playtime I’ve recently played with coroutines and generators and discovered that cooperative multitasking is unlikely to outperform threaded multitasking.
I wanted to play with generators and coroutines in C++. Coroutines are a feature I really like in python. In a nutshell a coroutine is a function that can suspend itself and return a value on each suspend. This is called
yielding. The next iteration of C++ will include coroutines and add the keyword
co_yieldto perform yielding. In this post I’ll show my implementation of a coroutine-like generator.