Step 1: Understanding the system setup.
We have two masses, \( m_1 \) and \( m_2 \), connected by massless strings. Both masses are hanging from a common support. The tension in the upper string \( T_1 \) must support the weight of both masses, as the entire system is in equilibrium. The force due to gravity acting on each mass is given by:
- The weight of the first mass \( m_1 \) is \( W_1 = m_1 g \), where \( g \) is the acceleration due to gravity.
- The weight of the second mass \( m_2 \) is \( W_2 = m_2 g \).
Step 2: Analyzing the forces.
In the vertical direction, since the system is in equilibrium, the total force acting on the upper string must be equal to the sum of the weights of both masses. The tension in the upper string must support both \( m_1 \) and \( m_2 \), so the tension \( T_1 \) is the sum of their weights:
\[
T_1 = W_1 + W_2 = m_1 g + m_2 g
\]
Step 3: Simplifying the expression for the tension.
Factor out the common term \( g \) from the equation:
\[
T_1 = (m_1 + m_2) g
\]
Thus, the tension in the upper string is \( T_1 = (m_1 + m_2) g \).
Step 4: Conclusion.
The tension in the upper string is the sum of the weights of both masses, which is given by \( (m_1 + m_2) g \). Therefore, the correct answer is option (D).
Final Answer: (D) \( (m_1 + m_2) g \)