Shallow donors are often introduced into semiconductor materials to enhance n-type conductivity. However, they can sometimes also be used to obtain compensation between donors and acceptors, resulting in high resistivity in semiconductors. For example, CdTe can be made semi-insulating by shallow donor doping. This is routinely done to obtain high resistivity in CdTe-based radiation detectors. However, it is widely believed that the shallow donor alone cannot be responsible for the high resistivity in CdTe. This is based on the argument that it is practically impossible to control the shallow donor doping level so precisely that the free carrier density can be brought below the desired value suitable for radiation detection applications. Therefore, a deep native donor is usually assumed to exist in CdTe and pin the Fermi level near midgap. In this paper, we present our calculations on carrier statistics and energetics of shallow donors and native defects in CdTe and illustrate different donorspecific mechanisms for achieving carrier compensation. Our results show that the shallow donor can be used to reliably obtain high resistivity in CdTe without requiring additional deep donors. Since radiation detection applications require both high resistivity and good carrier transport, one should generally use shallow donors and shallow acceptors for carrier compensation and avoid deep centers that are effective carrier traps. This study highlights how the interaction between impurities and native defects intricately affects the Fermi level pinning in the semiconductor band gap and the associated resistivity of the material.