A safety valve is a type of control mechanism. Its function is to release pressure when pressure reaches a specified threshold. The safety valve then resets pressure back to the original position. A good example is the valve on a pressure cooker. Another is the safety setting on an autoclave. Contents are kept at or under a specified pressure. When this pressure is violated, an alarm goes off or a safety valve automatically resets the machine to a safe pressure. This prevents explosion or accident. A safety valve has a storage unit which stores an excess of fluid beyond the specified limit set. Safety valves are used when expensive fluids are used.
A relief valve is a mechanism that immediately relieves pressure. The relief valve is triggered in dangerous circumstances. For example, when the pressure has abruptly exceeded or is approaching a situation which would result in the failure of the system. The result of a failure might be materials would approach their yield limit or parts might start breaking. A good example is the relief valve on a fire engine. If pressure on the hoses exceeds a limit the relief valve would relieve the pressure to prevent hoses from rupturing. In oil refinery or a chemical plant if a fire occurs or if a system fails, the relief valve would immediately relieve pressure avoiding explosions. A relief valve doesn't have a storage unit storing excess fluid. It is used when less expensive or less important fluids are involved.