KHB: Synthesis: An Efficient Implementation of Fundamental Operating Systems Services
Posted Feb 27, 2008 17:30 UTC (Wed) by pphaneuf
Parent article: KHB: Synthesis: An Efficient Implementation of Fundamental Operating Systems Services
The trick of changing between two algorithms is pretty awesome, and something more or less like that could easily be done with many pieces of code in the kernel. I did similar things in user-space C++ code, by using callbacks for some things, where I basically encoded part of the state in the function pointer itself (in state A, point at do_state_A, in state B, point at do_state_B, something like that), which was kind of ugly in C++, as it basically was hand-coded virtual methods, so that I could change them at runtime (and per object).
But in the kernel, we're already implementing virtual methods by hand, and on top of it, we don't use per-class virtual method tables, but rather embed them in each objects already, which is exactly what we need! It's just that they are usually initialized once at object creation, we'd just need to use some atomic CAS to update a function pointer when some algorithm changes.
The trick part is when more than one method needs to change. Damn, I actually expect this would be common, too. Argh.
Oh well, it's pretty cool!
to post comments)