In my textbook, the definition of tension was given that Tension is the reactive force which exists when string is being stretched at its both end. After it there was a case given that to calculate acceleration and tension produced in string while it's attached with different masses at both its ends and passed over a frictionless pulley. First body is being hung and second is placed over horizontal frictionless surface with relatively smaller mass. It is given in my book that there are three forces acting on the body placed on horizontal smooth surface viz., Weight of body, the reaction force to weight and tension in string pulling body towards pulley's wheel. How can there be tension in string according to the definition given my book however there is no acting force (pulling force) on the body that pulls it away from wheel.
There are different definitions for tension. The one in our book is creating problem however second one, that is, " tension describes the pulling force exerted by each end of a string, cable, chain, or similar one-dimensional continuous object " is al right.
Since acceleration is lowered due to Tension then acceleration produced in the body must be given by, $a=\frac{Net-Force}{m}$ $=>$ $a=\frac{m_1g-T}{m_1}$ since $W_1$ $>$ $T$.
If tension in string is the reactive force to the weights pulling the string apart then according to Sir Isaac Newton, $W_1=W_2=T$.