How to program an operating system?