Thermodynamic equilibrium - will the piston move? Friend asked me this question and I didn't manage to solve it with basic thermodynamic reasoning. I believe this problem is easly solvable via numeric methods by choosing specific systems, though I prefer an analytic, more general and more intuitive solution.
Two different and isolated systems (which specified by $S_1(E_1,V_1,N_1)$ and $S_2(E_2,V_2,N_2)$) are seperatly prepeard to satisfy particular $(P,T)$ requirements, so that $P_1=P_2=P$ but $T_1 \ne T_2$. Afterwards the two systems are brough one near the other, with a single piston (unmovable at first) seperating them. The piston doesn't allow transfer of heat or particles at any stage. After the two systems were properly juxtaposed the restriction on the movement of the piston is removed. Will the piston move from its original position?
One way of treatment suggests that since $P_1=P_2$ and and since only mechanichal work (exchange) is allowed - the piston will not move.
Other way sugest that by forcing maximum entropy (thermodynamic equilibrium) for the combined system, we will get $dS_{tot}=dS_1+dS_2=0$, and in particular (since there is only one degree of freedom here) $\frac{\partial S_1}{\partial V_1}=\frac{\partial S_2}{\partial V_1}$ so at equilibrium $\frac{P_1}{T_1}=\frac{P_2}{T_2}$, hence the piston will move.
 A: This is certainly an interesting question.
As the question is currently put:


*

*The entropy argument says that the piston will eventually move.

*To know how fast it will move, we have to look at the rate of transfer of heat across the piston. If you have a perfectly insulating piston, this rate is zero. Therefore the first answer has to be qualified with: "eventually" means "never".


That is the literal resolution of your paradox. However, things get more interesting.
valerio92's answer purports to show, in detail, how the gas on the two sides of a perfectly insulating piston can tend towards the same temperature. But it doesn't really do this. Instead, it points out something far more fundamental and of direct relevance to your paradox: a rigid body can never be a perfect insulator. valerio92's mechanism works, and transfers kinetic energy, and therefore transfers heat.
Since no perfectly insulating piston is possible, your paradox is founded on an impossibility - so no wonder that it should lead to contradictory conclusions.
Like many paradoxes, yours points out deep and normally ignored facts about its premisses. This makes it thoroughly worthwhile. It is reminiscent of the paradoxes that people construct involving rigid bodies and the Special Theory of Relativity - push a rigid rod and the push is transmitted to the other end instantaneously - where the resolution of the paradox is that the Special Theory of Relativity makes the existence of perfectly rigid bodies impossible.
A: I will only make some qualitative and conceptual observations here that does not really deal with the specific problem, but shares some insight on why the two notions in the question are not conflicting. This may or may not answer the question.

One way of treatment suggests that since $P_1=P_2$ and and since only mechanichal work (exchange) is allowed - the piston will not move.

What this is really saying is that the statistical average of the pressures are equal, so it can not be read as "the pressure at all times are equal" since there are fluctuations present. Now these distributions can be described by thermodynamics (see e.g. wikipedia. Note that in this particular case one might have to consider the piston boundary conditions for finding the pressure fluctuations of the two systems). These fluctuations can take you out of the equilibrium, which will happen fast if the equilibrium is unstable and may take a long time if the equilibrium is metastable. This is where we would need to investigate the phase space of the particular problem, which I don't have time to do right now, but maybe this answer helps someone else do it.

Other way sugest that by forcing maximum entropy (thermodynamic equilibrium) for the combined system [...]

As is stated correctly the maximum entropy principle under the appropriate constraints describes thermodynamic equilibrium of the system. This of course presupposes that the system has a way to reach this equilibrium. Through fluctuations it is always possible, but one can for example construct extreme cases with one global minimum (equilibrium) and another local minimum with a massive fluctuation barrier to overcome, the system may well spend ages in the latter and only end up in the global minimum after a long time. After that it is also possible that it returns to the locally stable configurations.
So I have said what the system might do, which is of course not really an answer to the question, but this was to long for a comment, so I thought it might help as an answer.
A: You've discovered a famous problem in thermodynamics.
In our case the piston will not move. The mechanical argument is right, while the maximum entropy argument is inconclusive. 
To see that $P_1=P_2$ is an equilibrium position you can also apply conservation of energy. Since there is no heat exchange,
$$dU_{1,2} = -P_{1,2} dV_{1,2}$$
We require that $dU=0$ since our system is isolated from the environment, hence
$$dU_1 + dU_2 = 0  \to P_1 d V_1 + P_2 dV_2 = 0$$
But $V=V_1+V_2$ and $V$ is fixed, so that $dV_1 = - dV_2$ and we obtain
$$P_1=P_2$$
Now let's see the entropy maximum principle. The problem is that you forgot that $S$ is a function of energy too:
$$S(U,V)= S_1 (U_1, V_1)+ S_2 (U_2, V_2)$$
$$d S = dS_1 + dS_2 = \frac{dU_1}{T_1} + \frac{P_1}{T_1} dV_1 +  \frac{dU_2}{T_2} + \frac{P_2}{T_2} dV_2$$
Since $dU_{1,2} = -P_{1,2} dV_{1,2}$, we see that $dS$ vanishes identically, so that we can say nothing about $P_{1,2}$ and $T_{1,2}$: the entropy maximum principle is thus inconclusive.
Update 
Your question actually inspired me a lot of thoughts in the past days and I found out that...I was wrong.
I basically followed the argument given by Callen in his book Thermodynamics (Appendix C), but it looks like:


*

*There are some issues with the argument itself

*I misinterpreted the argument


My error was really silly: I only showed that $P_1=P_2$ is a necessary condition for equilibrium, not that it is a sufficient condition, i.e. (if the argument is correct and) if the system is at equilibrium, then $P_1=P_2$, but if $P_1=P_2$ the system could still be out of equilibrium...which it is!
I am still not really able to explain why the whole argument is wrong: some authors have said that equilibrium considerations should follow from the second law and not from the first and that the second law is not inconclusive.
You can read for example this article and this article. They both use only thermodynamics considerations, but I warn you that the second tries to contradict the first. So the problem, from a purely thermodynamic point of view, is really difficult to solve without making mistakes, and I have found no argument that persuaded me completely and for good.
This article takes into consideration exactly your problem and shows that the piston will move, making the additional assumption that the gases are ideal gases.

We take the initial temperatures, T1 and T2, to be different, and the initial pressures, p1 and p2, to be equal. Once unblocked, the piston gains a translational energy to the right of order 1/2KT1 from a collision with a side 1 molecule, and a translational energy to the left of order 1/2KT2 from a collision with a side 2 molecule . In this way energy passes mainly from side 2 to side 1 if T2>T1.
[...] In this process just considered, the pressures on the two sides of the piston are equal at all times, which means no "work" is done. However, the energy transfer occurs through the agency of the moving piston, and if one considers "work" to be the energy transferred via
  macroscopic, non-random motion, then it appears that "work" is done.

This is really similar to the argument given by Feynman in his lectures (39-4). Feynman basically uses kinetic theory arguments to show that if we start with $P_1 \neq P_2$ the piston will at first "slosh back and forth" (cit.) until $P_1 = P_2$, and then, due to random pressure fluctuations, slowly converge towards thermodynamic equilibrium ($T_1=T_2$). 
The argument is really tricky because we assume that if the pressure is the same on both side the piston will not move, forgetting that pressure is just $2/3$ of the density times the average kinetic energy per particle
$$P = \frac 2 3 \rho \langle \epsilon_K \rangle$$
just like temperature is basically the average kinetic energy (without the density multiplicative factor). So we are dealing with statistical quantities, which are not "constant" from a microscopic point of view. So while thermodynamically we say that if $P_1=P_2$ the piston won't move, from a microscopic point of view it will actually slightly jiggle back and forth because of the different collision it experiences from particles in the left and right sides.
There have been also simulations of your problem which show that if we start with $P_1=P_2$ and $T_1\neq T_2$ the piston will oscillate until we reach thermodynamic equilibrium ($T_1=T_2$). See the pictures below, which I took from the article.


A: For the first statement, there is no problem with it as everyone talks here. 
For the second statement, it is wrong because the two system are separated by the system without exchange heat. There will be no change in entropy. 
One simple and quick way to reason is that entropy change is accompanied by heat exchange, $$dS=\frac {dQ}{T}$$
A: The first suggestion that the piston will not move, is true, if the area of piston in contact with S1 = area of piston in contact with S2 (otherwise $F_1 = PA_1$would not equal $F_2 = PA_2$ and the difference in force will move the piston).
At the time when there is restriction in the piston, the pressure exerted on the piston by the system 1 is equal to the pressure exerted by the piston on the system 1 to prevent it from bloating (law of action-reaction). Now suppose you left system 1 alone and wait if any temperature or pressure changes. If you could not see any change, then the system 1 is in equilibrium with respect to the given parameters (P and T), and no such reactions are taking place so as to change its temperature, pressure, or number of molecules. And the same can be said for system 2.
Now, suppose you remove the restriction. At the start, the properties (P, T, N, E) of system 1 and system 2 are the same as before. But now, the pressure exerted by system 1 on the piston has become the pressure exerted by system 1 on system 2(at the area where they connect), and the pressure exerted by the piston on system 1 has become the pressure exerted by system 2 on system 1. But the two pressures are equal, so it is the same situation as before, and the pressure by system 2 will prevent system 1 from bloating, and vice versa.
Now, when you put vacuum on the other side (instead of system 2), then system 1 will start to expand indefinitely, since the pressure on the other side is 0, and the pressure in system 1 will tend to balance the other side, by expanding, thus reducing pressure and temp, and the only way to stop this is applying a balance pressure on the other side.
Now, what happens in the two equilibrium systems if you displace the piston a little bit (say toward system 2) and release it? (similarly, the displacement can be due to minor fluctuations on either system, and is manifested as a change in pressure, but if the fluctuations are not manifested as a change in pressure, the piston still cannot move no matter what) Assuming that a reduction in volume will increase the pressure, and an increase in volume will reduce the pressure, the pressure at the side of system 2 will be greater than system 1, causing a net force on the piston toward the direction of system 1, and when the piston has passed through the equilibrium position, and eventually displaced toward system 1, it will now have a net force on the piston toward system 2. This could go on and on, like a mass connected to a spring. But each time the piston passes through the equilibrium position, the pressure on both sides should be the same.
But, will there ever come a time when the equilibrium shifts to a different position than the original? We can view the situation on the point of view of either system (say system 1). For system 1, he doesn't care if system 2 exists, and he can only view the back and forth movement of the piston as if someone actually does a push and pull on the piston, and as he does it, he is applying work on the system as he pushes, and negative work as he pulls (Thus we can say that there is back and forth transfer of energy in the fluctuations). Lets say you yourself will move the piston. In order to change equilibrium position, the system must reach a point (due to the change in the condition of the system as you change its volume) wherein when that point is reached, and you return the system to its original equilibrium volume, the pressure would not be the same as the original (perhaps due to an irreversible process that occurred when the point is reached). My thought is that this doesn't occur for Ideal Gasses, whose properties are always governed by the equation $PV = nRT$ and work $\int PdV$ is the same when done from lower to higher volume then back from higher to lower (or am I right? I believe this situation is adiabatic, since there is no heat transfer, as the definition for an adiabatic process. so increasing volume adiabatically and then back adiabatically would produce back the initial  pressure and 0 net work). But this can happen for example if there is some carbon (and gasses) in that system, and by decreasing its volume (and increasing the pressure) the system comes to a point where the carbon in it is capable of transforming into diamond, and absorbing Q (from the gasses) in the process, so the effect is similar to actually removing heat from the system, so that when you return it to its original volume, the pressure would be lesser than the original equilibrium pressure (this might also occur if the system has for example water vapor, and at a specific temperature and pressure, will transform to water, and releasing Q and subtracting n from the gas phase). And when you now include the system 2, the system 2 (still at the original equilibrium pressure) can now push further toward system 1 and a new equilibrium can be reached. So if the fluctuations can actually reach that point, a shift in equilibrium position of the piston can occur.
These are just my thoughts, sorry for my lengthy answer. and also I am not familiar with the mathematical subtleties of second suggestion.
A: Here are my five cents: The system being constrained to move adiabatically does not necessarily imply that $\mathrm{d} S_1 = \mathrm{d} S_2 = 0$, this is only the case if one insists on identifying $ \delta Q_1 = T_1 \mathrm{d} S_1 $ and $ \delta Q_2 = T_2 \mathrm{d} S_2$, but this is not valid in general, and if this is taken into account the entropy change in each compartment need not vanish. Thus, if one considers all adiabatic paths, not only the ones in which $ \delta Q_2 = T_2 \mathrm{d} S_2$ ("reversible" ones or "quasistatic" ones, or whichever way you wish to call them, Callen calls them "quasistatic") then in the final equilibrium state $T_1 = T_2$ and $P_1 = P_2$. 
What follows is a slightly more in depth explanation: the entropy differential, if the total energy and volume of the system are held constant, and the particles in each container are conserved is:
\begin{equation*}
\mathrm{d} S = \left(\frac{1}{T_1} - \frac{1}{T_2}\right)\mathrm{d}U_1 + \left(\frac{P_1}{T_1} - \frac{P_2}{T_2}\right)\mathrm{d}V_1  
\end{equation*}
The energy differentials, on the other hand, are in general $\mathrm{d}U_1 = \delta Q_1 + \delta W_1$ and $\mathrm{d}U_2 = \delta Q_2 + \delta W_2$, but if one only considers adiabatic paths then $\mathrm{d}U_1 = \delta W_1 (= T_1 \mathrm{d}S_1 - P_1 \mathrm{d}V_1)$ and $\mathrm{d}U_2 = \delta W_2 (= T_2 \mathrm{d}S_2 - P_2 \mathrm{d}V_2)$.
For a state to be a equilibrium state the entropy differential must vanish, but since the energy differentials are not $\mathrm{d}U_j = -P_j\mathrm{d}V_j$ then the conditions necessary for the entropy differential to vanish are $T_1 = T_2$ and $P_1 = P_2$.
