A balloon contains gas with pressure $P_1$, volume $V_1$. It is connected to a container with vacuum with volume $V_2$, and the gas is released into the vacuum. What is the work done by the gas and the heat change of the system?
By conventional wisdom, the gas does not need to do any work against the vacuum to enter the container, so the work done is obviously $0$. But looking at it as $W=\int_{V_i}^{V_f}PdV$(in which the $W$ here is defined as the work done by the system on the surroundings), does that mean that the $P$ here in the integral is defined as the pressure exerted by the surroundings on the system? That doesn't seem to fit with wikipedia's definition, which says "$P$ denotes the pressure inside the system, that it exerts on the moving wall that transmits force to the surroundings"
To sum it up, my question is, does the $P$ in $W=\int_{V_i}^{V_f}PdV$ represent pressure of system on surroundings, or surroundings on system?