Advances in chip-multiprocessor processing capabilities have led to an increased power consumption and temperature hotspots. Maintaining the on-chip temperature is important from the power reduction and reliability considerations. Achieving highest performance while maintaining the temperature constraint is the real challenge. The authors develop analytical solutions for the optimal control of frequencies for each core in a chip multiprocessor. The objective is to reduce the makespan or the latest task completion time of all tasks. They show that the optimal frequency policy is bang-bang when the temperature constraint is not active and is exponential when the temperature constraint is active.