This article will go over a few things–IO, CPU caches, shared memory, atomics, juggling overheads, and the tradeoffs that emerge in systems design. We’re going to meander for a bit; go over some documentation, ponder the interfaces, look at an example, and then finally sketch out an absurd abomination of a library and compare it against a few obvious strategies.
We’re going to go through a nontrivial, albeit pointless, example of perf_event_open(). Now, perf_event_open() isn’t exactly something we use every day, so this discussion might come across as totally pointless (because it is, unless you’re in need of reference). So here we go.
In an earlier post I wrote a few things about argv, the array of strings that every application receives when it starts. That article demonstrated how modifying argv values also changes the results of ps and top. In other words, the sequence of operations which leads to tools such as ps and top acquiring process arguments involves reading the live memory of a running application.
Here’s a short one. Let’s pretend this is a standard kind of entry-level C++ interview, and I’ll impress you with how subtly wrong I can be about so many different things, and yet still produce a weirdly coherent sort of result at the end.
I’m going to make a brazenly inflammatory statement and play it off as a deeply held conviction. Unfortunately for both of us, my conviction here is heartfelt and it may be for the better if we both just assume otherwise.
I think some of us suffer from a delusion that esoterica brings power. To those people, knowing something about Einstein’s mother’s musical affinity inspires a feeling that one has gained a familiarity with the man . This myth has found repetition in many a fantasy story, where some trivial knowledge of a thing, such as its name or origin, grants control over it. Perhaps in our distant past our…