System Developing Essentials
- Stack and Register Dumper
- NMI and software Watchdog
- Tracepoint and Ring Buffer
- Whiskey and Luck
Keep in mind
- Stress your system
- Every single critical subsystem
- Confident with your base subsystem
- Fix bug/Improve perf at early stage
- Plan ahead
- Single thread, or thread pool?
- How to avoid using
- What lock to use?
- How to reduce
- Does this data structure need
- Should I use per-cpu data structures?
- Should I pad this lock $-line aligned to avoid pingpong?
- I’m fucking hate a crap kernel module just kill my machine, either stuck or bug.
- Free buffer/structure
- Remove the pointer from friends’ list/tree. If you forgot to do so, mostly you will have some silent memory corruption. So be kind, cleanup what you have done during intilization.
- Report error. Do not be SILENT.
Clever Buffer Management
- static pre-allocated array?
- Ring buffer?
- Other than kmem_cache, I used other two solutions to optimize various dynamic allocation in LegoOS. The motivation is very simple: some data structures will be allocated/free very very frequently at runtime. So we want to speed it up!
System Building Advice
- John Ousterhout
- If you don’t know what the problem was, you haven’t fixed it
- If it hasn’t been used, it doesn’t work