Using quadrupole mass spectrometer (QMS), the residual gases in the ultra-high vacuum system used for photocathodes activation are detected. The adsorption of Cs atom and residual gases molecules on Ga0.5Al0.5As 尾2 (2 脳 4) surface are investigated by density functional theory. Results show that Cs lowers the work function while residual gases enhance the work function. The changes of the work function are caused by the electron offsets between the adsorbates and the surface. Cs atom improves the absorption properties while residual gases molecules harm the absorption properties.