Optimal Priority Assignment to Control Tasks