I’m working on operating system implementation in Rust and I’m figuring out how to approach different problems.
Right now I’m looking for a way to deal with global “World State”. The whole point of OS kernel is to manage global state, while it must be fast and safe.
I don’t want to have global variables, as they make mocking and testing harder. I’d like to be able to test everything like it was pure and functional as much as I can.
One naive approach that I’m thinking about is to pass
&mut WorldState all over the code, but it seems tedious.
I’d be thankful for ideas, and pointers how to approach this. I know that game developers have similiar problems: games are full of global state.