rewrite resource allocation