How does the author identifies the irreversible process coming from the pressure difference? In the book of Prigogine, Modern Thermodynamics, at page 113, it is given the example of an irreversible expansion of a gas.

In a reversible expansion of a gas, the pressure of the gas and that
  on the piston are assumed to be the same. If we consider an isothermal
  expansion of a gas that has a constant temperature $T$ by virtue of
  its contact with a heat reservoir, the change in entropy of the gas de
  $S=\mathrm{d} Q / T,$ in which dQ is the heat flow from the reservoir
  to the gas that is necessary to maintain the temperature constant.
  This is an ideal situation. In any real expansion of a gas that takes
  place in a finite time, the pressure of the gas is greater than that
  on the piston. If $p_{gas }$ is the pressure of the gas and that
  $p_{piston}$ the pressure on the piston, the difference $(p_{gas} -
 p_{piston})dV$ is the force per unit area that moves the piston. The
  irreversible increase in entropy in this case is given by $$
 \mathrm{d}_{\mathrm{i}}
 S=\frac{p_{\mathrm{gas}}-p_{\mathrm{piston}}}{T} \mathrm{d} V>0 $$ In
  this case, the term ( $p_{\text {gas }}-p_{\text {piston }}$ ) /T
  corresponds to the 'thermodynamic force' and dV/dt the corresponding
  'flow'. The term ( $p_{\text {pas }}-P_{\text {piston }}$ ) dV may be
  identified as the "uncompensated heat' of Clausius. since the change
  in the volume and $\left(p_{\text {gas }}-p_{\text {piton }}\right)$
  have the same sign, di $S$ is always positive. In this case,
   $\mathrm{d} S=\mathrm{d}_{\mathrm{e}} S+$ $\mathrm{d}_{\mathrm{i}}
 S=\mathrm{d} Q /
 T+\left(p_{\mathrm{gas}}-\mathrm{p}_{\mathrm{piston}}\right)
 \mathrm{d} V / T .$ In the case of an ideal gas, since the energy is
  only a function of $T,$ the initial and final energies of the gas
  remain the same; the heat absorbed is equal to the work done in moving
  the piston $p_{piston}dV$.

However, the author does not give any explanation for how he figured out that the difference between $p_{gas}$ and $p_{piston}$ results in a irreversible process. In other words, I was given this question without the solution, how should I suppose to identify that there is a nonzero contribution to the entropy production coming from the work done by the pressure difference?
 A: The reason for $p_{gas}\ne p_{piston}$ in equilibrium or during a quasi-static process is that you have some friction between the walls and the piston or viscous effects within the gas, both processes being dissipative are irreversible.
A: The difference between the two pressures integrates to a residual force whose work is invested in accelerating the piston. However, at the end of the process the piston is static, so there must exist additional resisting forces acting during the process in the opposite sense, and it must hold that work done by the resisting forces must be equal to (minus) the work done by the residual force, as their sum results in zero change in the total kinetic energy. 
Moreover, by the end of the deceleration the work done by the residual forces through the piston on the surroundings has not accumulated as potential energy (as it would happen with elastic forces, for example), since the residual force is zero at the end of the process. This means that the resisting forces must be of dissipative nature, i.e., their work is transformed into heat that flows out of the system (increasing the total entropy), since the energy is either kinetic, potential or thermal. But once the heat has flowed out of the system, no infinitesimal change of the surroundings will make the thermal energy gather up and to push back the piston to reverse the process, making the process irreversible.
A: If, by $p_{gas}$, the author means the force per unit area that the gas exerts on the piston face, then this discussion is incorrect.  That is because, for a massless, frictionless piston, by Newton's 2nd law, the force the gas exerts on the inner piston face must match the external force on the piston, $p_{piston}A$.
On the other hand, if, by $p_{gas}$, the author means the pressure calculated from the ideal gas law nRT/V using the volume average temperature T during the irreversible process (the temperature of the gas during an irreversible process is typically not spatially uniform), then the assessment is basically correct.  In this case, $(p_{gas}-p_{piston})$ represents the contribution of viscous (dissipative) stresses to the force per unit area on the piston face.  And the expression $\frac{(p_{gas}-p_{piston})}{T}\frac{dV}{dt}$ approximates (crudely) the rate of viscous entropy generation within the gas.  There is a lot of hand-waving involved here, but at least it qualitatively alludes to a basic mechanism for entropy generation in an irreversible process.
