First we draw a diagram of this system (on whiteboard). Remember to label diagram correctly - the tension on both sides act towards each other.
Since B is a larger mass, we know that mass A will move upwards and mass B will fall to the ground. Now we can setup our simultaneous equations:
4g - T = 4a
T - 2g = 2a
Adding these together eliminates T and leaves us with: 4g - 2g = 6a --> 2g = 6a which means that acceleration = g/3
Substituting this back into either one of our first equations:
T = 2a + 2g
T = 2g/3 + 2g
Hence T = 8g/3