Does a free piston mean the process is isobaric, even when the piston is not massless?

If the piston is massless, the net force acting must be zero, so the pressure exerted by gas is constant and equal to the atmospheric pressure, provided there is no other external force. But what if the piston has some mass, it's free to move? Can't it accelerate making the force on the two sides unequal resulting to a variable pressure by gas? My teacher said it is isobaric, so i'm kinda confused.

• Is it your understanding that the piston come to rest in the final thermodynamic equilibrium state? Commented Jan 20, 2022 at 11:25

Further $$W=P_{\text{external}}\Delta V$$, where $$P_{\text{ext}}=\frac{mg}{A}+P_{\text{atm}}$$. Your teacher possibly assumed the thermodynamic process to be reversible beforehand.
If the piston comes to rest in the final equilibrium state, then any kinetic energy that was imparted to the piston during the process is ultimately dissipated within the gas. So, in the end, the net amount of work done by the gas on the piston turns out the same as if the piston were massless. So, in the end, your teacher was right, but he or she should have presented more details on why this is so, including an energy balance on the piston: $$W_{g,p}(t)-W_{p,a}(t)=K(t)$$ where $$W_{g,p}(t)$$ is the work done by the gas on the piston up to time t, $$W_{p,a}(t)$$ is the work done by the piston on the outside atmosphere up to time t, and K(t) is the kinetic energy of the piston at time t. At infinite time, when the piston comes to rest, we have: $$W_{g,p}(\infty)-W_{p,a}(\infty)=0$$or$$W_{g,p}(\infty)=W_{p,a}(\infty)=P_{atm}\Delta V$$