2024-01-13 from the editor of ~insom
------------------------------------------------------------
I spend a lot of the day reading and thinking about things
that interest me. In general this is good, but it can lead
to these unproductive loops where it _feels_ like I am doing
something (learning) but I am not applying anything and I'm
not even certain it's sinking in. I have nothing to show for
my time.
Now; not having something to show for your time is cool too.
That's really what "play" is, and it's healthy to have it in
your life. Most people could probably use more of it. But,
for me, a life of play doesn't really lead to satisfaction.
What's more, there's no built in signal to move on from a
topic (having done something with that knowledge) -- I
typically move on because I've gotten bored or at least
distracted by something new. This leads to me dropping a
whole load of context: meaning I will have to start nearly
from scratch to regain some of that knowledge.
Recently I did a pretty deep dive on an on-again-off-again
thing I want to understand: how does context switching work
in a kernel. Specifically, I would like to create a
scheduler with a couple of tasks, pre-empt them, and switch
between them.
I already knew a lot of this stuff _in theory_ -- each
process needs to have its own stack and switching processes
needs to push some registers, switch the stack, and pop some
registers. I inuited that some timer process could be
responsible for doing this: timers can be IRQ handlers and
that generally means operating in kernel-space. (Whatever
that means for the architecture that you're on).
That's nice, but it's not really enough information to
implement anything. After an evening spent reading assembly
source for an xv6 ARM port, for NetBSD and someone's helpful
guide to how FreeRTOS does this on ARM -- I had much more of
a clue. Probably enough to implement it. But I am not
currently able to give it the time that it needs -- I don't
need to (nor feel like) implementing my own scheduler right
now.
So, before I let myself move on: I wrote it all up in my
notes. I found gaps in my knowledge doing this. I cited a
bunch of articles (keeping them out of my bookmarks and
letting me close some tabs). When I come around to doing
this next time, I can start much quicker. I'm parked facing
down the hill.
Anyway this is a lot of words to say "notes are good" but,
you know, "notes are good". There's a reason university
students take them and I'm not quite sure when I stopped the
habit. Perhaps it was when I trained myself to believe that
knowledge (and not information) was just a search away, so
why should I write things down when I could just search
later.