Hardware-Software Co-Design for Energy Efficient Implementations of Operating Systems