Total pressure v/s Partial pressure If I have 2 containers, something like in the diagram. One has gas A, while other has gas B. Both containers have equal volume and at same temp. Then when I remove the corks, and let the gases flow, until when will they flow, and will I finally have a half of Gas A in one container and rest half in the other, and similarly for gas B, or will only one of them flow until total pressure in the 2 containers is same?

In other words, what is the necessary condition for flow of gas - Difference in its partial pressure, or difference in total pressure?
If the membrane is permeable to both gases, then both gases will become uniformly distributed between the two containers, and the final pressure will be uniform.  So, if the initial pressures in the two containers are $p_1$ and $p_2$, the initial number of moles in the two containers are $$n_1=\frac{p_1V}{RT}$$ and $$n_2=\frac{p_2V}{RT}$$  The total number of moles does not change, so the final pressure is $$p=\frac{(n_1+n_2)RT}{2V}=\frac{p_1+p_2}{2}$$The final mole fractions in the combined container are $p_1/(p_1+p_2)$, and $p_2/(p_1+p_2)$.  The final partial pressures are $p_1/2$ and $p_2/2$.