Optimal allocation of software resources: A risk management approach