ATP synthesis in glycolysis and the Krebs cycle is by substrate-level phosphorylation, where an inorganic phosphate is transferred from one molecule to ATP.
Oxidative phosphorylation uses an electron transport chain to create a proton motive force. The PMF will be across a biological membrane – in eukaryotes this is over the inner mitochondrial membrane, while prokaryotes use their inner cell membrane. As protons flow through the F1/Fo ATP synthase (eukaryotes) / complex V (prokaryotes), ADP is phosphorylated to form ATP.
By using the entire metabolic pathway for glucose metabolism (glycolysis, Krebs, and oxidative phosphorylation), the cell obtains the maximum ATP yield of ~30 ATP per glucose. This requires the present of oxygen, as for oxidative phosphorylation to reach maximal proton transport O2 is the best terminal electron acceptor. Other molecules can be used as terminal electron acceptors, however they do not allow the transport of so many protons.
Under normal resting conditions, glycolysis may provide adequate ATP. Pyruvate can be converted back to glucose, and so minimal energy can be expended at rest. If additional ATP is required, the link reaction, with its committed step (CO2 release), can be used to activate the Krebs cycle. Krebs can also be used for biosynthesis, with the cycle producing many synthetic pathway precursor molecules (such as for amino acid, nucleotide base synthesis).