We present Temperature Programmed Desorption (TPD) experiments of CO and N2 ices in pure, layered and mixed morphologies at various ice thicknesses and abundance ratios as well as simultaneously taken Reflection Absorption Infrared Spectra (RAIRS) of CO. A kinetic model has been developed to constrain the binding energies of CO and N2 in both pure and mixed environments and to derive the kinetics for desorption, mixing and segregation. For mixed ices N2 desorption occurs in a single step whereas for layered ices it proceeds in two steps, one corresponding to N2 desorption from a pure N2 ice environment and one corresponding to desorption from a mixed ice environment. The latter is dominant for astrophysically relevant ice thicknesses. The ratio of the binding energies, Rbe, for pure N2 and CO is found to be 0.936 +/- 0.03, and to be close to 1 for mixed ice fractions. The model is applied to astrophysically relevant conditions for cold pre-stellar cores and for protostars which start to heat their surroundings. The importance of treating CO desorption with zeroth rather than first order kinetics is shown. The experiments also provide lower limits of 0.87 +/- 0.05 for the sticking probabilities of CO-CO, N2-CO and N2-N2 ices at 14 K. The combined results from the desorption experiments, the kinetic model, and the sticking probability data lead to the conclusion that these solid-state processes of CO and N2 are very similar under astrophysically relevant conditions. This conclusion affects the explanations for the observed anti-correlations of gaseous CO and N2H+ in pre-stellar and protostellar cores.