  We investigate the conditions for the existence of an expanding virial shock
in the gas falling within a spherical dark-matter halo. The shock relies on
pressure support by the shock-heated gas behind it. When the radiative cooling
is efficient compared to the infall rate the post-shock gas becomes unstable;
it collapses inwards and cannot support the shock.
  We find for a monoatomic gas that the shock is stable when the post-shock
pressure and density obey gamma effective>10/7, with gamma effective begin the
time depended equivalent to the adiabatic index. We express the effective gamma
in terms of r, u and rho at the shock to obtain a simple condition for shock
stability. This result is confirmed by hydrodynamical simulations, using an
accurate spheri-symmetric Lagrangian code. When the stability analysis is
applied in cosmology, we find that a virial shock does not develop in most
haloes that form before z ~ 2, and it never forms in haloes less massive than a
few 10^11 solar masses. In such haloes the infalling gas is never heated to the
virial temperature, and it does not need to cool radiatively before it drops
into a disc. Instead, the gas collapses at T ~ 10^4K directly into the disc.
This should have nontrivial effects on the star-formation rate and on the gas
removal by supernova-driven winds. Instead of radiating soft x rays, this gas
would emit lyman alpha thus helping explain the low flux of soft x-ray
background and the lyman alpha emitters observed at high redshift.
