While looking for resources and ideas regarding self-modifying code I came across this Ph.D. dissertation from the early 90's "Synthesis: An Efficient Implimentation of Fundamental Operating System Services". It actually has some pretty cool stuff in it: self-modifying code for context switches and optimization, lock-free synchronization primitives, and fine-grained (compared to normal CPU quantum) scheduling for real-time processing. The lock-free implementation seems particularly forward-thinking given the many-core world we live in today.