I was studying cathode ray experiment and there the electrons were obtained by ionisation of the gas inthe tube by the high voltage on the electrodes. So how does this happen?
There is always a small amount of ions and electrons in gases due omnipresent radiation ( cosmic radiation and radioactive decays. Depending of scenario, there is possible an electron injection by thermo-emission ( heated cathodes ) or by pin-point electrode geometry ( various DIY ozone or light negative ion generators ).
When voltage is applied on the tube electrodes, ions/electrons are accelerated and collisions create other ions. At normal pressure, the path between collisions is too short (mean free flight path for air molecules is typically 70 nm), so enormous potential gradient is needed for high enough collision energy.
Low pressure allows longer acceleration paths along higher potential difference, leading to higher collision energy. Finally there is established equilibrium between ionization and ion recombination, including hitting the electrodes.