Can a system in thermodynamic equilibrium perform work? For concreteness, consider a hydrostatic system in mechanical equilibrium. For example, a gas in a cylinder with a piston of weight $mg$ in equilibrium. In the situation of equilibrium, $$mg=PA\tag{1}$$ where $A$ is area of the piston and $P$ is the pressure exerted by the gas. Since the hydrostatic workdone is given by $$W=\int PdV,\tag{2}$$ and because $P\neq 0$, the it is possible for the system to perform work even when the condition (1) is satisfied. The forces are balanced doesn't necessarily mean that there is no work done. The piston can have non-zero but uniform velocity even when the net force on it is zero. 
$\bullet$ Does it mean that a system in equilibrium can perform work and workdone doesn't require deviation from equilibrium? 
EDIT: I'm not talking about quasistatic processes in which at each step the system is infinitesimally close to equilibrium and passes through several equilibrium configurations at each step. I'm asking whether a system in a given equilibrium configuration $\mathcal{C}$ can perform work without deviating from $\mathcal{C}$.
I think, if at any instant of time $t$, when the condition (1) is satisfied, it is possible that the piston can have a nonzero velocity. But as soon as the piston moves up or down, the internal pressure drops and the equilibrium is disturbed, Therefore, it is not possible to maintain the same equilibrium state $\mathcal{C}$ while performing work. As soon as the piston moves, the system deviates from $\mathcal{C}$ charecterized by a given set of variables $(P,V,T)$. 
I'm not sure whether my line of reasoning is correct.
 A: For work to be performed, an imbalance would have to be created. That means, forces would be imbalanced and the velocity of something somewhere would have to change. A system in equilibrium won't perform work on anything.
In your case, you could add mass to your original mass and that could create an imbalance and cause the piston to compress. Or, you could remove mass and cause the piston to expand. The act of adding or removing creates an imbalance.
Also in your case, you could heat or cool the gas. That would also create an imbalance causing the piston to compress or expand.
The original system won't do anything unless an "imbalance" is imparted to it. Nothing will happen spontaneously.
The problem you are describing sounds much like the method of "Virtual Displacements" that's used frequently in structural analysis. That method considers a system, already in equilibrium, that is given a virtual displacement. Since the system is already in equilibrium, the forces within the already-stressed system perform no net work whatsoever.
A: If you don't assume a quasi-static process, neither of your equations will hold (of course that integral has a minus sign that your have dropped). The reason is that, in such a process, pressure of the system can't be defined.
But if you assume that any process is done slowly, looking at the expression of work for a hydro-static system,
$$\delta W=-PdV$$
Yes. $P$ is not zero. But you also will need some non-zero $dV$ which means you have to move the piston. If you don't, there is no work done.
Generally, when we label a system as "In equilibrium", we mean thermodynamic equilibrium, and thermodynamic equilibrium is achieved when three kinds of equilibrium are present:


*

*mechanical equilibrium: there exists no un-canceled force.

*chemical equilibrium: the system is not willing to perform a chemical reaction, solution, a macroscopic flow of particle due to chemical reasons.

*thermal equilibrium: temperature is the same everywhere.


If these are satisfied, you are limited from any aspect. So, you can't do work.
