The osmotic pressure is given by the expression Π=CRT.
Thus, the osmotic pressure is directly proportional to the concentration.
Two solutions will have same osmotic pressure if they have same concentration.
Let w be the mass of glucose present in 0.5 L of solution.
Hence, w180g/mol×0.5L=8g180g/mol×1L
w=4g
Hence, the mass of glucose present in 0.5 L of solution is 4 g.