Take internal energy for example: $$dU\leq TdS-PdV$$ Firstly, I would like to make clear that the following question/argument relies on the following statement being correct: the left hand side of the above equation represents the change in internal energy of the system and the right hand side represents the work done on the system by the surroundings. Please clarify if that is correct.
The two equations, above, are in fact inequalities where it only becomes an equality when the system is at equilibrium (when changes are reversible). However, when the system is not in equilibrium the inequality implies that the work done on the system by the surroundings is greater than the internal energy gained by the system; how can this be? Where does the energy difference between the energy put in and the energy gained by the system go?
Secondly, at a constant $S$ and $V$, spontaneous changes occur only when $dU \leq 0$. What's going on here? Is it as simple as: the system must lose internal energy in a spontaneous change or does it mean that work must be done on/by the system in a different way (eg. electrical work)?