engine resource scheduling, redux

This is the latest incarnation of #649 and #657 - it proved almost impossible
to rebase those onto master, so this involves a merge instead.
So is this code ready to review?